diff options
| author | Urgau <3616612+Urgau@users.noreply.github.com> | 2024-10-16 12:03:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-16 12:03:41 +0200 |
| commit | f7af3aa7dcef25ed66cc3b290df6e52dc4a3595d (patch) | |
| tree | ab339e3f38f43d5fec8bc0f7f0b320371c68159c | |
| parent | 9c7d57954c6a35cebd24c02351c7153ef6238521 (diff) | |
| parent | 373142aaa1e64f8a1e9071deaf0675c181ca3b47 (diff) | |
| download | rust-f7af3aa7dcef25ed66cc3b290df6e52dc4a3595d.tar.gz rust-f7af3aa7dcef25ed66cc3b290df6e52dc4a3595d.zip | |
Rollup merge of #131712 - tgross35:const-lazy_cell_into_inner, r=joboet
Mark the unstable LazyCell::into_inner 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
| -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") } |
