stabilize const_cell_into_inner · qinheping/verify-rust-std@b8c2a2a (original) (raw)
`@@ -514,7 +514,8 @@ impl Cell {
`
514
514
`/// assert_eq!(five, 5);
`
515
515
```` /// ```
`516`
`516`
`#[stable(feature = "move_cell", since = "1.17.0")]
`
`517`
``
`-
#[rustc_const_unstable(feature = "const_cell_into_inner", issue = "78729")]
`
``
`517`
`+
#[rustc_const_stable(feature = "const_cell_into_inner", since = "CURRENT_RUSTC_VERSION")]
`
``
`518`
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
`518`
`519`
`pub const fn into_inner(self) -> T {
`
`519`
`520`
`self.value.into_inner()
`
`520`
`521`
`}
`
`@@ -857,7 +858,8 @@ impl<T> RefCell<T> {
`
`857`
`858`
`/// let five = c.into_inner();
`
`858`
`859`
```` /// ```
859
860
`#[stable(feature = "rust1", since = "1.0.0")]
`
860
``
`-
#[rustc_const_unstable(feature = "const_cell_into_inner", issue = "78729")]
`
``
861
`+
#[rustc_const_stable(feature = "const_cell_into_inner", since = "CURRENT_RUSTC_VERSION")]
`
``
862
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
861
863
`#[inline]
`
862
864
`pub const fn into_inner(self) -> T {
`
863
865
`` // Since this function takes self
(the RefCell
) by value, the
``
`@@ -2098,8 +2100,8 @@ impl UnsafeCell {
`
2098
2100
```` /// ```
````
2099
2101
`#[inline(always)]
`
2100
2102
`#[stable(feature = "rust1", since = "1.0.0")]
`
2101
``
`` -
// When this is const stabilized, please remove primitive_into_inner
below.
``
2102
``
`-
#[rustc_const_unstable(feature = "const_cell_into_inner", issue = "78729")]
`
``
2103
`+
#[rustc_const_stable(feature = "const_cell_into_inner", since = "CURRENT_RUSTC_VERSION")]
`
``
2104
`+
#[rustc_allow_const_fn_unstable(const_precise_live_drops)]
`
2103
2105
`pub const fn into_inner(self) -> T {
`
2104
2106
`self.value
`
2105
2107
`}
`
`@@ -2245,47 +2247,6 @@ impl<T: CoerceUnsized, U> CoerceUnsized<UnsafeCell> for UnsafeCell {}
`
2245
2247
`#[unstable(feature = "dispatch_from_dyn", issue = "none")]
`
2246
2248
`impl<T: DispatchFromDyn, U> DispatchFromDyn<UnsafeCell> for UnsafeCell {}
`
2247
2249
``
2248
``
`-
// Special cases of UnsafeCell::into_inner where T is a primitive. These are
`
2249
``
`-
// used by Atomic*::into_inner.
`
2250
``
`-
//
`
2251
``
`-
// The real UnsafeCell::into_inner cannot be used yet in a stable const function.
`
2252
``
`-
// That is blocked on a "precise drop analysis" unstable const feature.
`
2253
``
`-
// https://github.com/rust-lang/rust/issues/73255
`
2254
``
`-
macro_rules! unsafe_cell_primitive_into_inner {
`
2255
``
`-
($($primitive:ident $atomic:literal)*) => {
`
2256
``
`-
$(
`
2257
``
`-
#[cfg(target_has_atomic_load_store = $atomic)]
`
2258
``
`-
impl UnsafeCell<$primitive> {
`
2259
``
`-
pub(crate) const fn primitive_into_inner(self) -> $primitive {
`
2260
``
`-
self.value
`
2261
``
`-
}
`
2262
``
`-
}
`
2263
``
`-
)*
`
2264
``
`-
};
`
2265
``
`-
}
`
2266
``
-
2267
``
`-
unsafe_cell_primitive_into_inner! {
`
2268
``
`-
i8 "8"
`
2269
``
`-
u8 "8"
`
2270
``
`-
i16 "16"
`
2271
``
`-
u16 "16"
`
2272
``
`-
i32 "32"
`
2273
``
`-
u32 "32"
`
2274
``
`-
i64 "64"
`
2275
``
`-
u64 "64"
`
2276
``
`-
i128 "128"
`
2277
``
`-
u128 "128"
`
2278
``
`-
isize "ptr"
`
2279
``
`-
usize "ptr"
`
2280
``
`-
}
`
2281
``
-
2282
``
`-
#[cfg(target_has_atomic_load_store = "ptr")]
`
2283
``
`-
impl UnsafeCell<*mut T> {
`
2284
``
`-
pub(crate) const fn primitive_into_inner(self) -> *mut T {
`
2285
``
`-
self.value
`
2286
``
`-
}
`
2287
``
`-
}
`
2288
``
-
2289
2250
`` /// [UnsafeCell
], but [Sync
].
``
2290
2251
`///
`
2291
2252
`` /// This is just an UnsafeCell
, except it implements Sync
``