library: Stabilize const_replace
· qinheping/verify-rust-std@3b820ee (original) (raw)
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -138,7 +138,6 @@ | ||
138 | 138 | #![feature(const_ptr_is_null)] |
139 | 139 | #![feature(const_ptr_sub_ptr)] |
140 | 140 | #![feature(const_raw_ptr_comparison)] |
141 | -#![feature(const_replace)] | |
142 | 141 | #![feature(const_size_of_val)] |
143 | 142 | #![feature(const_size_of_val_raw)] |
144 | 143 | #![feature(const_strict_overflow_ops)] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -857,7 +857,8 @@ pub fn take<T: Default>(dest: &mut T) -> T { | ||
857 | 857 | #[inline] |
858 | 858 | #[stable(feature = "rust1", since = "1.0.0")] |
859 | 859 | #[must_use = "if you don't need the old value, you can just assign the new value directly"] |
860 | -#[rustc_const_unstable(feature = "const_replace", issue = "83164")] | |
860 | +#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] | |
861 | +#[rustc_const_stable(feature = "const_replace", since = "CURRENT_RUSTC_VERSION")] | |
861 | 862 | #[cfg_attr(not(test), rustc_diagnostic_item = "mem_replace")] |
862 | 863 | pub const fn replace<T>(dest: &mut T, src: T) -> T { |
863 | 864 | // It may be tempting to use `swap` to avoid `unsafe` here. Don't! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1263,7 +1263,8 @@ const unsafe fn swap_nonoverlapping_simple_untyped(x: *mut T, y: *mut T, coun | ||
1263 | 1263 | /// ``` |
1264 | 1264 | #[inline] |
1265 | 1265 | #[stable(feature = "rust1", since = "1.0.0")] |
1266 | -#[rustc_const_unstable(feature = "const_replace", issue = "83164")] | |
1266 | +#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))] | |
1267 | +#[rustc_const_stable(feature = "const_replace", since = "CURRENT_RUSTC_VERSION")] | |
1267 | 1268 | #[rustc_diagnostic_item = "ptr_replace"] |
1268 | 1269 | pub const unsafe fn replace<T>(dst: *mut T, src: T) -> T { |
1269 | 1270 | // SAFETY: the caller must guarantee that `dst` is valid to be |