Skip to content

Commit 332d128

Browse files
authored
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: <rust-lang/rust#67441>
2 parents da2f01b + 9019b0e commit 332d128

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(rustc_private)]
22
#![feature(cell_update)]
3-
#![feature(const_option)]
43
#![feature(float_gamma)]
54
#![feature(map_try_insert)]
65
#![feature(never_type)]

0 commit comments

Comments
 (0)