Skip to content

Commit 9791b14

Browse files
committed
Change __rust_no_alloc_shim_is_unstable to be a function
1 parent 871de6e commit 9791b14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

alloc/src/alloc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ unsafe extern "Rust" {
3131
#[rustc_std_internal_symbol]
3232
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
3333

34+
#[rustc_nounwind]
3435
#[rustc_std_internal_symbol]
35-
static __rust_no_alloc_shim_is_unstable: u8;
36+
fn __rust_no_alloc_shim_is_unstable_v2();
3637
}
3738

3839
/// The global memory allocator.
@@ -88,7 +89,7 @@ pub unsafe fn alloc(layout: Layout) -> *mut u8 {
8889
unsafe {
8990
// Make sure we don't accidentally allow omitting the allocator shim in
9091
// stable code until it is actually stabilized.
91-
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
92+
__rust_no_alloc_shim_is_unstable_v2();
9293

9394
__rust_alloc(layout.size(), layout.align())
9495
}
@@ -171,7 +172,7 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
171172
unsafe {
172173
// Make sure we don't accidentally allow omitting the allocator shim in
173174
// stable code until it is actually stabilized.
174-
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
175+
__rust_no_alloc_shim_is_unstable_v2();
175176

176177
__rust_alloc_zeroed(layout.size(), layout.align())
177178
}

0 commit comments

Comments
 (0)