Skip to content

Commit 863123b

Browse files
committed
Add const_cell_into_inner to OnceCell
`Cell` and `RefCell` have their `into_inner` methods const unstable. `OnceCell` has the same logic, so add it under the same gate. Tracking issue: rust-lang#78729
1 parent d37ebfe commit 863123b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: core/src/cell/once.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ impl<T> OnceCell<T> {
309309
/// ```
310310
#[inline]
311311
#[stable(feature = "once_cell", since = "1.70.0")]
312-
pub fn into_inner(self) -> Option<T> {
312+
#[rustc_const_unstable(feature = "const_cell_into_inner", issue = "78729")]
313+
pub const fn into_inner(self) -> Option<T> {
313314
// Because `into_inner` takes `self` by value, the compiler statically verifies
314315
// that it is not currently borrowed. So it is safe to move out `Option<T>`.
315316
self.inner.into_inner()

0 commit comments

Comments
 (0)