Skip to content

Commit 353f7d5

Browse files
committed
add special exception for std_miri_test crate to call std-only functions
1 parent f633537 commit 353f7d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/helpers.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
803803
// Fall back to the instance of the function itself.
804804
let instance = instance.unwrap_or(frame.instance);
805805
// Now check if this is in the same crate as start_fn.
806-
this.tcx.def_path(instance.def_id()).krate == this.tcx.def_path(start_fn).krate
806+
// As a special exception we also allow unit tests from
807+
// <https://github.com/rust-lang/miri-test-libstd/tree/master/std_miri_test> to call these
808+
// shims.
809+
let frame_crate = this.tcx.def_path(instance.def_id()).krate;
810+
frame_crate == this.tcx.def_path(start_fn).krate
811+
|| this.tcx.crate_name(frame_crate).as_str() == "std_miri_test"
807812
}
808813

809814
/// Handler that should be called when unsupported functionality is encountered.

0 commit comments

Comments
 (0)