diff options
| -rw-r--r-- | library/core/src/lib.rs | 1 | ||||
| -rw-r--r-- | library/core/src/option.rs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 550e07f9d57..46a6ec09962 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -82,6 +82,7 @@ #![feature(const_fn_union)] #![feature(const_generics)] #![feature(const_option)] +#![feature(const_precise_live_drops)] #![feature(const_ptr_offset)] #![feature(const_ptr_offset_from)] #![feature(const_raw_ptr_comparison)] diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 5932f8e5856..3c7211fe040 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -380,7 +380,8 @@ impl<T> Option<T> { #[inline] #[track_caller] #[stable(feature = "rust1", since = "1.0.0")] - pub fn unwrap(self) -> T { + #[rustc_const_unstable(feature = "const_option", issue = "67441")] + pub const fn unwrap(self) -> T { match self { Some(val) => val, None => panic!("called `Option::unwrap()` on a `None` value"), |
