Files
rust/compiler/rustc_data_structures
Trevor Gross 4426dcd56d Rollup merge of #161712 - theemathas:stab-into-ok-err, r=nia-e
Stabilize `Result::into_{ok,err}`

Tracking issue: https://github.com/rust-lang/rust/issues/61695

---

As evidence of the demand of this API, here are some instances of people having written functions for this functionality:
* 6cc14c4a44/crates/common-utils/src/misc.rs (L7)
* 788e83fa72/src/server/http.rs (L93)
* ea38c0e3b2/nostr/src/util/mod.rs (L120)
* 3d51315599/ngrok/examples/tls.rs (L92)
* b54c112d7d/openraft/openraft/src/error/into_ok.rs (L10)
* 30956f62e6/firmware/src/main.rs (L54)

---

API being stabilized:

```rust
impl<T, E> Result<T, E> {
    pub fn into_ok(self) -> T
    where
        E: Into<!>
    { .... }
    pub fn into_err(self) -> E
    where
        T: Into<!>,
    { .... }
}
```

---

Implementation history: (I'm including only ones that touches the public API being stabilized, and not documentation or constification)

* https://github.com/rust-lang/rfcs/pull/2799
* https://github.com/rust-lang/rust/pull/66045
* https://github.com/rust-lang/rust/pull/83421
* https://github.com/rust-lang/rust/pull/92444
2026-09-28 23:20:39 -05:00
..
2026-08-09 19:58:29 +00:00