@@ -715,28 +715,17 @@ fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
715
715
// This is needed to make the `target.runner` settings do something,
716
716
// and it later helps us detect which crates are proc-macro/build-script
717
717
// (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.
724
720
cmd. arg ( "--target" ) ;
725
- cmd. arg ( & host) ;
726
- & host
727
- } ;
721
+ cmd. arg ( version_info ( ) . host ) ;
722
+ }
728
723
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. :)
729
726
let cargo_miri_path_for_toml = escape_for_toml ( & cargo_miri_path) ;
730
727
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']" ) ) ;
740
729
741
730
// Forward all further arguments after `--` to cargo.
742
731
cmd. arg ( "--" ) . args ( args) ;
0 commit comments