@@ -406,7 +406,8 @@ impl<T> Cell<T> {
406406 /// assert_eq!(five, 5);
407407 /// ```
408408 #[ stable( feature = "move_cell" , since = "1.17.0" ) ]
409- pub fn into_inner ( self ) -> T {
409+ #[ rustc_const_unstable( feature = "const_cell_into_inner" , issue = "none" ) ]
410+ pub const fn into_inner ( self ) -> T {
410411 self . value . into_inner ( )
411412 }
412413}
@@ -668,12 +669,11 @@ impl<T> RefCell<T> {
668669 /// let five = c.into_inner();
669670 /// ```
670671 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
672+ #[ rustc_const_unstable( feature = "const_cell_into_inner" , issue = "none" ) ]
671673 #[ inline]
672- pub fn into_inner ( self ) -> T {
674+ pub const fn into_inner ( self ) -> T {
673675 // Since this function takes `self` (the `RefCell`) by value, the
674676 // compiler statically verifies that it is not currently borrowed.
675- // Therefore the following assertion is just a `debug_assert!`.
676- debug_assert ! ( self . borrow. get( ) == UNUSED ) ;
677677 self . value . into_inner ( )
678678 }
679679
@@ -1682,7 +1682,8 @@ impl<T> UnsafeCell<T> {
16821682 /// ```
16831683 #[ inline]
16841684 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1685- pub fn into_inner ( self ) -> T {
1685+ #[ rustc_const_unstable( feature = "const_cell_into_inner" , issue = "none" ) ]
1686+ pub const fn into_inner ( self ) -> T {
16861687 self . value
16871688 }
16881689}
0 commit comments