about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2023-04-16 07:20:26 +0000
committerDeadbeef <ent3rm4n@gmail.com>2023-04-16 07:20:26 +0000
commit63e0ddbf1d820ee62892eee7a50e381d964f1dec (patch)
tree28b0f8142c97b67bd00044aa700efbea1224a4e2 /library/core/src/ptr
parente80c0204455534c5d9ec4f92dd8bffd392513fc3 (diff)
downloadrust-63e0ddbf1d820ee62892eee7a50e381d964f1dec.tar.gz
rust-63e0ddbf1d820ee62892eee7a50e381d964f1dec.zip
core is now compilable
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/const_ptr.rs3
-rw-r--r--library/core/src/ptr/mut_ptr.rs3
-rw-r--r--library/core/src/ptr/non_null.rs3
-rw-r--r--library/core/src/ptr/unique.rs7
4 files changed, 8 insertions, 8 deletions
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs
index fe6efba6003..1a442c8bb84 100644
--- a/library/core/src/ptr/const_ptr.rs
+++ b/library/core/src/ptr/const_ptr.rs
@@ -1650,9 +1650,8 @@ impl<T> *const [T] {
     /// }
     /// ```
     #[unstable(feature = "slice_ptr_get", issue = "74265")]
-    #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
     #[inline]
-    pub const unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
+    pub unsafe fn get_unchecked<I>(self, index: I) -> *const I::Output
     where
         I: SliceIndex<[T]>,
     {
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index 5af28dea472..9912648554b 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -2036,9 +2036,8 @@ impl<T> *mut [T] {
     /// }
     /// ```
     #[unstable(feature = "slice_ptr_get", issue = "74265")]
-    #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
     #[inline(always)]
-    pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
+    pub unsafe fn get_unchecked_mut<I>(self, index: I) -> *mut I::Output
     where
         I: SliceIndex<[T]>,
     {
diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index fdb428ff4e6..506d891d989 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -676,9 +676,8 @@ impl<T> NonNull<[T]> {
     /// }
     /// ```
     #[unstable(feature = "slice_ptr_get", issue = "74265")]
-    #[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
     #[inline]
-    pub const unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
+    pub unsafe fn get_unchecked_mut<I>(self, index: I) -> NonNull<I::Output>
     where
         I: SliceIndex<[T]>,
     {
diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs
index 35478976985..a853f15edb7 100644
--- a/library/core/src/ptr/unique.rs
+++ b/library/core/src/ptr/unique.rs
@@ -70,7 +70,8 @@ impl<T: Sized> Unique<T> {
     #[must_use]
     #[inline]
     pub const fn dangling() -> Self {
-        Self::from(NonNull::dangling())
+        // FIXME(const-hack) replace with `From`
+        Unique { pointer: NonNull::dangling(), _marker: PhantomData }
     }
 }
 
@@ -134,7 +135,9 @@ impl<T: ?Sized> Unique<T> {
     #[must_use = "`self` will be dropped if the result is not used"]
     #[inline]
     pub const fn cast<U>(self) -> Unique<U> {
-        Unique::from(self.pointer.cast())
+        // FIXME(const-hack): replace with `From`
+        // SAFETY: is `NonNull`
+        unsafe { Unique::new_unchecked(self.pointer.cast().as_ptr()) }
     }
 }