Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e14df05

Browse files
committed
set runner for all targets via 'all()'
1 parent dd01870 commit e14df05

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

cargo-miri/bin.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -715,28 +715,17 @@ fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
715715
// This is needed to make the `target.runner` settings do something,
716716
// and it later helps us detect which crates are proc-macro/build-script
717717
// (host crates) and which crates are needed for the program itself.
718-
let host = version_info().host;
719-
let target = get_arg_flag_value("--target");
720-
let target = if let Some(ref target) = target {
721-
target
722-
} else {
723-
// No target given. Pick default and tell cargo about it.
718+
if get_arg_flag_value("--target").is_none() {
719+
// No target given. Explicitly pick the host.
724720
cmd.arg("--target");
725-
cmd.arg(&host);
726-
&host
727-
};
721+
cmd.arg(version_info().host);
722+
}
728723

724+
// Set ourselves as runner for al binaries invoked by cargo.
725+
// We use `all()` since `true` is not a thing in cfg-lang, but the empty conjunction is. :)
729726
let cargo_miri_path_for_toml = escape_for_toml(&cargo_miri_path);
730727
cmd.arg("--config")
731-
.arg(format!("target.{target}.runner=[{cargo_miri_path_for_toml}, 'runner']",));
732-
if &host != target {
733-
// Set ourselves as runner for host and target. (Unit tests of `proc-macro` crates are run on
734-
// the host, so we set the host runner to us in order to skip them.)
735-
// But only do that if host and target are different; setting this command twice otherwise
736-
// makes cargo concatenate the two arrays.
737-
cmd.arg("--config")
738-
.arg(format!("target.{host}.runner=[{cargo_miri_path_for_toml}, 'runner']",));
739-
}
728+
.arg(format!("target.'cfg(all())'.runner=[{cargo_miri_path_for_toml}, 'runner']"));
740729

741730
// Forward all further arguments after `--` to cargo.
742731
cmd.arg("--").args(args);

0 commit comments

Comments
 (0)