Rollup merge of #131120 - tgross35:stabilize-const_option, r=RalfJung
Stabilize `const_option`
This makes the following API stable in const contexts:
```rust
impl<T> Option<T> {
pub const fn as_mut(&mut self) -> Option<&mut T>;
pub const fn expect(self, msg: &str) -> T;
pub const fn unwrap(self) -> T;
pub const unsafe fn unwrap_unchecked(self) -> T;
pub const fn take(&mut self) -> Option<T>;
pub const fn replace(&mut self, value: T) -> Option<T>;
}
impl<T> Option<&T> {
pub const fn copied(self) -> Option<T>
where T: Copy;
}
impl<T> Option<&mut T> {
pub const fn copied(self) -> Option<T>
where T: Copy;
}
impl<T, E> Option<Result<T, E>> {
pub const fn transpose(self) -> Result<Option<T>, E>
}
impl<T> Option<Option<T>> {
pub const fn flatten(self) -> Option<T>;
}
```
The following functions make use of the unstable `const_precise_live_drops` feature:
- `expect`
- `unwrap`
- `unwrap_unchecked`
- `transpose`
- `flatten`
Fixes: <https://github.com/rust-lang/rust/issues/67441>
This commit is contained in:
@@ -111,7 +111,6 @@
|
||||
#![feature(const_eval_select)]
|
||||
#![feature(const_heap)]
|
||||
#![feature(const_maybe_uninit_write)]
|
||||
#![feature(const_option)]
|
||||
#![feature(const_pin)]
|
||||
#![feature(const_size_of_val)]
|
||||
#![feature(const_vec_string_slice)]
|
||||
|
||||
Reference in New Issue
Block a user