Skip to content

Commit ab135f0

Browse files
committed
Change __rust_no_alloc_shim_is_unstable to be a function
1 parent 4313fec commit ab135f0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/shims/extern_static.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ impl<'tcx> MiriMachine<'tcx> {
4545

4646
/// Sets up the "extern statics" for this machine.
4747
pub fn init_extern_statics(ecx: &mut MiriInterpCx<'tcx>) -> InterpResult<'tcx> {
48-
// "__rust_no_alloc_shim_is_unstable"
49-
let val = ImmTy::from_int(0, ecx.machine.layouts.u8); // always 0, value does not matter
50-
Self::alloc_extern_static(ecx, "__rust_no_alloc_shim_is_unstable", val)?;
51-
5248
// "__rust_alloc_error_handler_should_panic"
5349
let val = ecx.tcx.sess.opts.unstable_opts.oom.should_panic();
5450
let val = ImmTy::from_int(val, ecx.machine.layouts.u8);

src/shims/foreign_items.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,10 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
611611
this.write_pointer(new_ptr, dest)
612612
});
613613
}
614+
name if name == this.mangle_internal_symbol("__rust_no_alloc_shim_is_unstable_v2") => {
615+
// This is a no-op shim that only exists to prevent making the allocator shims instantly stable.
616+
let [] = this.check_shim(abi, CanonAbi::Rust, link_name, args)?;
617+
}
614618

615619
// C memory handling functions
616620
"memcmp" => {

tests/pass/alloc-access-tracking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![no_std]
22
#![no_main]
3-
//@compile-flags: -Zmiri-track-alloc-id=20 -Zmiri-track-alloc-accesses -Cpanic=abort
4-
//@normalize-stderr-test: "id 20" -> "id $$ALLOC"
3+
//@compile-flags: -Zmiri-track-alloc-id=19 -Zmiri-track-alloc-accesses -Cpanic=abort
4+
//@normalize-stderr-test: "id 19" -> "id $$ALLOC"
55
//@only-target: linux # alloc IDs differ between OSes (due to extern static allocations)
66

77
extern "Rust" {

0 commit comments

Comments
 (0)