File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ check-aux:
5959 build-std \
6060 $(BOOTSTRAP_ARGS )
6161 # Run standard library tests in Miri.
62+ # We have to forward RUSTC_BOOTSTRAP so that libtest accepts the unstable args bootstrap sets.
6263 $(Q ) MIRIFLAGS=" -Zmiri-strict-provenance" \
6364 $(BOOTSTRAP ) miri --stage 2 \
6465 library/core \
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments