@@ -406,7 +406,8 @@ impl<T> Cell<T> {
406
406
/// assert_eq!(five, 5);
407
407
/// ```
408
408
#[ 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 {
410
411
self . value . into_inner ( )
411
412
}
412
413
}
@@ -668,12 +669,11 @@ impl<T> RefCell<T> {
668
669
/// let five = c.into_inner();
669
670
/// ```
670
671
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
672
+ #[ rustc_const_unstable( feature = "const_cell_into_inner" , issue = "none" ) ]
671
673
#[ inline]
672
- pub fn into_inner ( self ) -> T {
674
+ pub const fn into_inner ( self ) -> T {
673
675
// Since this function takes `self` (the `RefCell`) by value, the
674
676
// 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 ) ;
677
677
self . value . into_inner ( )
678
678
}
679
679
@@ -1682,7 +1682,8 @@ impl<T> UnsafeCell<T> {
1682
1682
/// ```
1683
1683
#[ inline]
1684
1684
#[ 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 {
1686
1687
self . value
1687
1688
}
1688
1689
}
0 commit comments