Skip to content

Commit 4056df5

Browse files
committed
cargo-miri: better debug output; reorder a comment to make it less confusing
1 parent 2a93942 commit 4056df5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

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

+7-3
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);
@@ -213,7 +217,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
213217
}
214218

215219
// Run cargo.
216-
debug_cmd("[cargo-miri miri]", verbose, &cmd);
220+
debug_cmd("[cargo-miri cargo]", verbose, &cmd);
217221
exec(cmd)
218222
}
219223

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

+3-3
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)