Skip to content

Commit 92c10cf

Browse files
committed
miri: fix sysroot build
1 parent 47e065b commit 92c10cf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,10 @@ impl Step for Crate {
27552755
// `lib.rs` file, and a `lib.miri.rs` file exists in the same folder, we build that
27562756
// instead. But crucially we only do that for the library, not the test builds.
27572757
cargo.env("MIRI_REPLACE_LIBRS_IF_NOT_TEST", "1");
2758+
// std needs to be built with `-Zforce-unstable-if-unmarked`. For some reason the builder
2759+
// does not set this directly, but relies on the rustc wrapper to set it, and we are not using
2760+
// the wrapper -- hence we have to set it ourselves.
2761+
cargo.rustflag("-Zforce-unstable-if-unmarked");
27582762
cargo
27592763
} else {
27602764
// Also prepare a sysroot for the target.

src/tools/miri/cargo-miri/src/setup.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ pub fn setup(
136136
// But keep the overflow checks, they are cheap. This completely overwrites flags
137137
// the user might have set, which is consistent with normal `cargo build` that does
138138
// not apply `RUSTFLAGS` to the sysroot either.
139-
let rustflags = &["-Cdebug-assertions=off", "-Coverflow-checks=on"];
139+
// We also need to set `force-unstable-if-unmarked` to ensure the sysroot builds.
140+
let rustflags =
141+
&["-Cdebug-assertions=off", "-Coverflow-checks=on", "-Zforce-unstable-if-unmarked"];
140142

141143
let mut after_build_output = String::new(); // what should be printed when the build is done.
142144
let notify = || {

0 commit comments

Comments
 (0)