Skip to content

Commit 6b7dbff

Browse files
committed
coretest in miri: fix using unstable libtest features
1 parent 4d31406 commit 6b7dbff

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

  • src/bootstrap/src/core/build_steps

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,13 @@ impl Step for Miri {
741741

742742
// Run it again for mir-opt-level 4 to catch some miscompilations.
743743
if builder.config.test_args().is_empty() {
744-
cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
744+
cargo.env(
745+
"MIRIFLAGS",
746+
format!(
747+
"{} -O -Zmir-opt-level=4 -Cdebug-assertions=yes",
748+
env::var("MIRIFLAGS").unwrap_or_default()
749+
),
750+
);
745751
// Optimizations can change backtraces
746752
cargo.env("MIRI_SKIP_UI_CHECKS", "1");
747753
// `MIRI_SKIP_UI_CHECKS` and `RUSTC_BLESS` are incompatible
@@ -3108,6 +3114,17 @@ impl Step for Crate {
31083114
// does not set this directly, but relies on the rustc wrapper to set it, and we are not using
31093115
// the wrapper -- hence we have to set it ourselves.
31103116
cargo.rustflag("-Zforce-unstable-if-unmarked");
3117+
// Miri is told to invoke the libtest runner and bootstrap sets unstable flags
3118+
// for that runner. That only works when RUSTC_BOOTSTRAP is set. Bootstrap sets
3119+
// that flag but Miri by default does not forward the host environment to the test.
3120+
// Here we set up MIRIFLAGS to forward that env var.
3121+
cargo.env(
3122+
"MIRIFLAGS",
3123+
format!(
3124+
"{} -Zmiri-env-forward=RUSTC_BOOTSTRAP",
3125+
env::var("MIRIFLAGS").unwrap_or_default()
3126+
),
3127+
);
31113128
cargo
31123129
} else {
31133130
// Also prepare a sysroot for the target.

0 commit comments

Comments
 (0)