Skip to content

Commit

Permalink
Unrolled build for rust-lang#131712
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rust-timer authored Oct 16, 2024
2 parents d829780 + 373142a commit d1da239
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/cell/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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")
}

0 comments on commit d1da239

Please sign in to comment.