Skip to content

Commit 6f3e65c

Browse files
authoredOct 16, 2024
Rollup merge of rust-lang#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: rust-lang#125623
2 parents 151c0c7 + e788410 commit 6f3e65c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎core/src/cell/lazy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
7979
/// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
8080
/// ```
8181
#[unstable(feature = "lazy_cell_into_inner", issue = "125623")]
82-
pub fn into_inner(this: Self) -> Result<T, F> {
82+
pub const fn into_inner(this: Self) -> Result<T, F> {
8383
match this.state.into_inner() {
8484
State::Init(data) => Ok(data),
8585
State::Uninit(f) => Err(f),
@@ -306,6 +306,6 @@ impl<T: fmt::Debug, F> fmt::Debug for LazyCell<T, F> {
306306

307307
#[cold]
308308
#[inline(never)]
309-
fn panic_poisoned() -> ! {
309+
const fn panic_poisoned() -> ! {
310310
panic!("LazyCell instance has previously been poisoned")
311311
}

0 commit comments

Comments
 (0)