about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2021-11-06 05:56:09 +0100
committerest31 <MTest31@outlook.com>2021-11-09 20:09:56 +0100
commiteeaa2f16aa4487d3e5fdaef7097b488d45b986d2 (patch)
tree24b426920a2a453d8184fd82bba64e1226c08615 /library/core/src/ptr
parentd32993afe81a49701edd6f2b8f018020ca50da1a (diff)
downloadrust-eeaa2f16aa4487d3e5fdaef7097b488d45b986d2.tar.gz
rust-eeaa2f16aa4487d3e5fdaef7097b488d45b986d2.zip
Extend the const_swap feature
This makes the inherent method ptr::swap unstably
const, as well as slice::swap{,_unchecked}.
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/mut_ptr.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index adc64cb2bd3..5d5527dc8b4 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -1092,8 +1092,9 @@ impl<T: ?Sized> *mut T {
     ///
     /// [`ptr::swap`]: crate::ptr::swap()
     #[stable(feature = "pointer_methods", since = "1.26.0")]
+    #[rustc_const_unstable(feature = "const_swap", issue = "83163")]
     #[inline(always)]
-    pub unsafe fn swap(self, with: *mut T)
+    pub const unsafe fn swap(self, with: *mut T)
     where
         T: Sized,
     {