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
This commit is contained in:
parent
9322d183f4
commit
373142aaa1
@ -79,7 +79,7 @@ pub const fn new(f: F) -> 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
fn panic_poisoned() -> ! {
|
||||
const fn panic_poisoned() -> ! {
|
||||
panic!("LazyCell instance has previously been poisoned")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user