From 353f7d539ae628a46ecfa1c316d963633e17e780 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 4 Aug 2022 09:55:18 -0400 Subject: [PATCH] add special exception for std_miri_test crate to call std-only functions --- src/helpers.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helpers.rs b/src/helpers.rs index 220347ff1b9..7c9f8740eb4 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -803,7 +803,12 @@ fn frame_in_std(&self) -> bool { // Fall back to the instance of the function itself. let instance = instance.unwrap_or(frame.instance); // Now check if this is in the same crate as start_fn. - this.tcx.def_path(instance.def_id()).krate == this.tcx.def_path(start_fn).krate + // As a special exception we also allow unit tests from + // to call these + // shims. + let frame_crate = this.tcx.def_path(instance.def_id()).krate; + frame_crate == this.tcx.def_path(start_fn).krate + || this.tcx.crate_name(frame_crate).as_str() == "std_miri_test" } /// Handler that should be called when unsupported functionality is encountered.