about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorDaniel Paoliello <danpao@microsoft.com>2025-05-15 16:38:46 -0700
committerDaniel Paoliello <danpao@microsoft.com>2025-06-16 10:54:07 -0700
commit6906b44e1c667705ce04626901a75d51f4910de3 (patch)
tree87983dca4b601e0d6d234988486f3c6ceb4c4859 /library/alloc/src
parentd9ca9bd014074e2bac567eaa2b66bfacb2591028 (diff)
Change __rust_no_alloc_shim_is_unstable to be a function
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/alloc.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index e1cc4ba25c4..b4176e9c1f4 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -31,8 +31,9 @@ unsafe extern "Rust" {
     #[rustc_std_internal_symbol]
     fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
 
+    #[rustc_nounwind]
     #[rustc_std_internal_symbol]
-    static __rust_no_alloc_shim_is_unstable: u8;
+    fn __rust_no_alloc_shim_is_unstable_v2();
 }
 
 /// The global memory allocator.
@@ -88,7 +89,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
     unsafe {
         // Make sure we don't accidentally allow omitting the allocator shim in
         // stable code until it is actually stabilized.
-        core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
+        __rust_no_alloc_shim_is_unstable_v2();
 
         __rust_alloc(layout.size(), layout.align())
     }
@@ -171,7 +172,7 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
     unsafe {
         // Make sure we don't accidentally allow omitting the allocator shim in
         // stable code until it is actually stabilized.
-        core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
+        __rust_no_alloc_shim_is_unstable_v2();
 
         __rust_alloc_zeroed(layout.size(), layout.align())
     }