Skip to content

Commit 829aadc

Browse files
committed
Auto merge of #123192 - RalfJung:bootstrap-test-miri, r=onur-ozkan
Refactor the way bootstrap invokes `cargo miri` Instead of basically doing `cargo run --manifest-path=<cargo-miri's manifest> -- miri`, let's invoke the `cargo-miri` binary directly. That means less indirections, and also makes it easier to e.g. run the libcore test suite in Miri. (But there are still other issues with that.) Also also adjusted Miri's stage numbering so that it is consistent with rustc/rustdoc. This also makes `./x.py test miri` honor `--no-doc`. And this fixes rust-lang/rust#123177 by moving where we handle parallel_compiler.
2 parents a284c5c + a560cb4 commit 829aadc

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cargo-miri/src/phases.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
8989
let verbose = num_arg_flag("-v");
9090

9191
// Determine the involved architectures.
92-
let rustc_version = VersionMeta::for_command(miri_for_host())
93-
.expect("failed to determine underlying rustc version of Miri");
92+
let rustc_version = VersionMeta::for_command(miri_for_host()).unwrap_or_else(|err| {
93+
panic!(
94+
"failed to determine underlying rustc version of Miri ({:?}):\n{err:?}",
95+
miri_for_host()
96+
)
97+
});
9498
let host = &rustc_version.host;
9599
let target = get_arg_flag_value("--target");
96100
let target = target.as_ref().unwrap_or(host);
@@ -222,7 +226,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
222226
}
223227

224228
// Run cargo.
225-
debug_cmd("[cargo-miri miri]", verbose, &cmd);
229+
debug_cmd("[cargo-miri cargo]", verbose, &cmd);
226230
exec(cmd)
227231
}
228232

cargo-miri/src/setup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ pub fn setup(
9090
let cargo_cmd = {
9191
let mut command = cargo();
9292
// Use Miri as rustc to build a libstd compatible with us (and use the right flags).
93+
// We set ourselves (`cargo-miri`) instead of Miri directly to be able to patch the flags
94+
// for `libpanic_abort` (usually this is done by bootstrap but we have to do it ourselves).
95+
// The `MIRI_CALLED_FROM_SETUP` will mean we dispatch to `phase_setup_rustc`.
9396
// However, when we are running in bootstrap, we cannot just overwrite `RUSTC`,
9497
// because we still need bootstrap to distinguish between host and target crates.
9598
// In that case we overwrite `RUSTC_REAL` instead which determines the rustc used
9699
// for target crates.
97-
// We set ourselves (`cargo-miri`) instead of Miri directly to be able to patch the flags
98-
// for `libpanic_abort` (usually this is done by bootstrap but we have to do it ourselves).
99-
// The `MIRI_CALLED_FROM_SETUP` will mean we dispatch to `phase_setup_rustc`.
100100
let cargo_miri_path = std::env::current_exe().expect("current executable path invalid");
101101
if env::var_os("RUSTC_STAGE").is_some() {
102102
assert!(env::var_os("RUSTC").is_some());

0 commit comments

Comments
 (0)