drop some const unstables, due to revert no longer possible

This commit is contained in:
Mark Rousskov 2021-05-03 14:29:29 -04:00
parent 80ec986f9f
commit 28e5e93fc2
3 changed files with 4 additions and 8 deletions

View File

@ -682,8 +682,7 @@ pub unsafe fn uninitialized<T>() -> T {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_swap", issue = "83163")] pub fn swap<T>(x: &mut T, y: &mut T) {
pub const fn swap<T>(x: &mut T, y: &mut T) {
// SAFETY: the raw pointers have been created from safe mutable references satisfying all the // SAFETY: the raw pointers have been created from safe mutable references satisfying all the
// constraints on `ptr::swap_nonoverlapping_one` // constraints on `ptr::swap_nonoverlapping_one`
unsafe { unsafe {
@ -813,8 +812,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "if you don't need the old value, you can just assign the new value directly"] #[must_use = "if you don't need the old value, you can just assign the new value directly"]
#[rustc_const_unstable(feature = "const_replace", issue = "83164")] pub fn replace<T>(dest: &mut T, src: T) -> T {
pub const fn replace<T>(dest: &mut T, src: T) -> T {
// SAFETY: We read from `dest` but directly write `src` into it afterwards, // SAFETY: We read from `dest` but directly write `src` into it afterwards,
// such that the old value is not duplicated. Nothing is dropped and // such that the old value is not duplicated. Nothing is dropped and
// nothing here can panic. // nothing here can panic.

View File

@ -463,8 +463,7 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
} }
#[inline] #[inline]
#[rustc_const_unstable(feature = "const_swap", issue = "83163")] pub(crate) unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
pub(crate) const unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
// For types smaller than the block optimization below, // For types smaller than the block optimization below,
// just swap directly to avoid pessimizing codegen. // just swap directly to avoid pessimizing codegen.
if mem::size_of::<T>() < 32 { if mem::size_of::<T>() < 32 {

View File

@ -1013,9 +1013,8 @@ impl<T: ?Sized> *mut T {
/// ///
/// [`ptr::write`]: crate::ptr::write() /// [`ptr::write`]: crate::ptr::write()
#[stable(feature = "pointer_methods", since = "1.26.0")] #[stable(feature = "pointer_methods", since = "1.26.0")]
#[rustc_const_unstable(feature = "const_ptr_write", issue = "none")]
#[inline] #[inline]
pub const unsafe fn write(self, val: T) pub unsafe fn write(self, val: T)
where where
T: Sized, T: Sized,
{ {