diff options
| author | Trevor Gross <tmgross@umich.edu> | 2024-10-14 17:15:53 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2024-10-14 17:16:01 -0400 |
| commit | 373142aaa1e64f8a1e9071deaf0675c181ca3b47 (patch) | |
| tree | 962e00b7ad6270c0be55306dadfa12272643bb45 /library/core/src | |
| parent | 9322d183f45e0fd5a509820874cc5ff27744a479 (diff) | |
Mark LazyCell::into_inner unstably const
Other cell `into_inner` functions are const and there shouldn't be any problem here. Make the unstable `LazyCell::into_inner` const under the same gate as its stability (`lazy_cell_into_inner`). Tracking issue: https://github.com/rust-lang/rust/issues/125623
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/cell/lazy.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/cell/lazy.rs b/library/core/src/cell/lazy.rs index 5bc13779af9..d323fbeac9c 100644 --- a/library/core/src/cell/lazy.rs +++ b/library/core/src/cell/lazy.rs @@ -79,7 +79,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> { /// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string())); /// ``` #[unstable(feature = "lazy_cell_into_inner", issue = "125623")] - pub fn into_inner(this: Self) -> Result<T, F> { + pub const fn into_inner(this: Self) -> Result<T, F> { match this.state.into_inner() { State::Init(data) => Ok(data), State::Uninit(f) => Err(f), @@ -306,6 +306,6 @@ impl<T: fmt::Debug, F> fmt::Debug for LazyCell<T, F> { #[cold] #[inline(never)] -fn panic_poisoned() -> ! { +const fn panic_poisoned() -> ! { panic!("LazyCell instance has previously been poisoned") } |
