about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2024-03-19 09:34:31 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2024-03-20 08:49:13 -0400
commit02f193059528c6dd93f042ce277094f1d14cae77 (patch)
tree29c6bd403851ec418f7f5241b3c8b74cd7aecbd4 /library/core/src/ptr
parente4c58eb8da4ccd3af97b0254d2a3ed33a84b7cca (diff)
step cfgs
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/const_ptr.rs23
-rw-r--r--library/core/src/ptr/mut_ptr.rs12
2 files changed, 7 insertions, 28 deletions
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs
index 979fd1e4b4a..69c61602073 100644
--- a/library/core/src/ptr/const_ptr.rs
+++ b/library/core/src/ptr/const_ptr.rs
@@ -48,12 +48,8 @@ impl<T: ?Sized> *const T {
             }
         }
 
-        // on bootstrap bump, remove unsafe block
-        #[cfg_attr(not(bootstrap), allow(unused_unsafe))]
-        // SAFETY: The two versions are equivalent at runtime.
-        unsafe {
-            const_eval_select((self as *const u8,), const_impl, runtime_impl)
-        }
+        #[allow(unused_unsafe)]
+        const_eval_select((self as *const u8,), const_impl, runtime_impl)
     }
 
     /// Casts to a pointer of another type.
@@ -818,13 +814,8 @@ impl<T: ?Sized> *const T {
                 true
             }
 
-            #[cfg_attr(not(bootstrap), allow(unused_unsafe))]
-            // on bootstrap bump, remove unsafe block
-            // SAFETY: This function is only used to provide the same check that the const eval
-            // interpreter does at runtime.
-            unsafe {
-                intrinsics::const_eval_select((this, origin), comptime, runtime)
-            }
+            #[allow(unused_unsafe)]
+            intrinsics::const_eval_select((this, origin), comptime, runtime)
         }
 
         assert_unsafe_precondition!(
@@ -1648,11 +1639,7 @@ impl<T: ?Sized> *const T {
         // The cast to `()` is used to
         //   1. deal with fat pointers; and
         //   2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
-        #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
-        // SAFETY: The two versions are equivalent at runtime.
-        unsafe {
-            const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
-        }
+        const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
     }
 }
 
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index bfdd9dba320..1add9ca2311 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -48,11 +48,7 @@ impl<T: ?Sized> *mut T {
             }
         }
 
-        #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
-        // SAFETY: The two versions are equivalent at runtime.
-        unsafe {
-            const_eval_select((self as *mut u8,), const_impl, runtime_impl)
-        }
+        const_eval_select((self as *mut u8,), const_impl, runtime_impl)
     }
 
     /// Casts to a pointer of another type.
@@ -1906,11 +1902,7 @@ impl<T: ?Sized> *mut T {
         // The cast to `()` is used to
         //   1. deal with fat pointers; and
         //   2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
-        #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
-        // SAFETY: The two versions are equivalent at runtime.
-        unsafe {
-            const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
-        }
+        const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
     }
 }