Skip to content

Commit 9d96b0e

Browse files
committed
Revert effects of PRs 81167 and 83091.
This is preparation for reverting 81238 for short-term resolution of issue 84297.
1 parent 595088d commit 9d96b0e

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

library/core/src/mem/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,7 @@ pub unsafe fn uninitialized<T>() -> T {
682682
/// ```
683683
#[inline]
684684
#[stable(feature = "rust1", since = "1.0.0")]
685-
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
686-
pub const fn swap<T>(x: &mut T, y: &mut T) {
685+
pub fn swap<T>(x: &mut T, y: &mut T) {
687686
// SAFETY: the raw pointers have been created from safe mutable references satisfying all the
688687
// constraints on `ptr::swap_nonoverlapping_one`
689688
unsafe {
@@ -813,8 +812,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
813812
#[inline]
814813
#[stable(feature = "rust1", since = "1.0.0")]
815814
#[must_use = "if you don't need the old value, you can just assign the new value directly"]
816-
#[rustc_const_unstable(feature = "const_replace", issue = "83164")]
817-
pub const fn replace<T>(dest: &mut T, src: T) -> T {
815+
pub fn replace<T>(dest: &mut T, src: T) -> T {
818816
// SAFETY: We read from `dest` but directly write `src` into it afterwards,
819817
// such that the old value is not duplicated. Nothing is dropped and
820818
// nothing here can panic.

library/core/src/ptr/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,7 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
430430
}
431431

432432
#[inline]
433-
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
434-
pub(crate) const unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
433+
pub(crate) unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
435434
// NOTE(eddyb) SPIR-V's Logical addressing model doesn't allow for arbitrary
436435
// reinterpretation of values as (chunkable) byte arrays, and the loop in the
437436
// block optimization in `swap_nonoverlapping_bytes` is hard to rewrite back
@@ -564,8 +563,7 @@ const unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
564563
/// ```
565564
#[inline]
566565
#[stable(feature = "rust1", since = "1.0.0")]
567-
#[rustc_const_unstable(feature = "const_replace", issue = "83164")]
568-
pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
566+
pub unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
569567
// SAFETY: the caller must guarantee that `dst` is valid to be
570568
// cast to a mutable reference (valid for writes, aligned, initialized),
571569
// and cannot overlap `src` since `dst` must point to a distinct
@@ -871,8 +869,7 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
871869
/// ```
872870
#[inline]
873871
#[stable(feature = "rust1", since = "1.0.0")]
874-
#[rustc_const_unstable(feature = "const_ptr_write", issue = "none")]
875-
pub const unsafe fn write<T>(dst: *mut T, src: T) {
872+
pub unsafe fn write<T>(dst: *mut T, src: T) {
876873
// SAFETY: the caller must guarantee that `dst` is valid for writes.
877874
// `dst` cannot overlap `src` because the caller has mutable access
878875
// to `dst` while `src` is owned by this function.

library/core/src/ptr/mut_ptr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,9 +1002,8 @@ impl<T: ?Sized> *mut T {
10021002
///
10031003
/// [`ptr::write`]: crate::ptr::write()
10041004
#[stable(feature = "pointer_methods", since = "1.26.0")]
1005-
#[rustc_const_unstable(feature = "const_ptr_write", issue = "none")]
10061005
#[inline(always)]
1007-
pub const unsafe fn write(self, val: T)
1006+
pub unsafe fn write(self, val: T)
10081007
where
10091008
T: Sized,
10101009
{

0 commit comments

Comments
 (0)