@@ -7,6 +7,8 @@ use std::io::BufReader;
77use std:: path:: PathBuf ;
88use std:: process:: Command ;
99
10+ use rustc_version:: VersionMeta ;
11+
1012use crate :: { setup:: * , util:: * } ;
1113
1214const CARGO_MIRI_HELP : & str = r#"Runs binary crates and tests in Miri
@@ -90,12 +92,14 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
9092 let verbose = num_arg_flag ( "-v" ) ;
9193
9294 // Determine the involved architectures.
93- let host = version_info ( ) . host ;
95+ let rustc_version = VersionMeta :: for_command ( miri_for_host ( ) )
96+ . expect ( "failed to determine underlying rustc version of Miri" ) ;
97+ let host = & rustc_version. host ;
9498 let target = get_arg_flag_value ( "--target" ) ;
95- let target = target. as_ref ( ) . unwrap_or ( & host) ;
99+ let target = target. as_ref ( ) . unwrap_or ( host) ;
96100
97101 // We always setup.
98- setup ( & subcommand, & host , target ) ;
102+ setup ( & subcommand, target , & rustc_version ) ;
99103
100104 // Invoke actual cargo for the job, but with different flags.
101105 // We re-use `cargo test` and `cargo run`, which makes target and binary handling very easy but
@@ -146,7 +150,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
146150 if get_arg_flag_value ( "--target" ) . is_none ( ) {
147151 // No target given. Explicitly pick the host.
148152 cmd. arg ( "--target" ) ;
149- cmd. arg ( & host) ;
153+ cmd. arg ( host) ;
150154 }
151155
152156 // Set ourselves as runner for al binaries invoked by cargo.
@@ -204,7 +208,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
204208
205209#[ derive( Debug , Copy , Clone , PartialEq ) ]
206210pub enum RustcPhase {
207- /// `rustc` called via `xargo` for sysroot build.
211+ /// `rustc` called during sysroot build.
208212 Setup ,
209213 /// `rustc` called by `cargo` for regular build.
210214 Build ,
@@ -264,7 +268,7 @@ pub fn phase_rustc(mut args: impl Iterator<Item = String>, phase: RustcPhase) {
264268 let verbose = std:: env:: var ( "MIRI_VERBOSE" )
265269 . map_or ( 0 , |verbose| verbose. parse ( ) . expect ( "verbosity flag must be an integer" ) ) ;
266270 let target_crate = is_target_crate ( ) ;
267- // Determine whether this is cargo/xargo invoking rustc to get some infos.
271+ // Determine whether this is cargo invoking rustc to get some infos.
268272 let info_query = get_arg_flag_value ( "--print" ) . is_some ( ) || has_arg_flag ( "-vV" ) ;
269273
270274 let store_json = |info : CrateRunInfo | {
0 commit comments