@@ -22,8 +22,6 @@ use std::path::PathBuf;
22
22
23
23
struct MiriCompilerCalls {
24
24
default : RustcDefaultCalls ,
25
- /// whether we are building for the host
26
- host_target : bool ,
27
25
}
28
26
29
27
impl < ' a > CompilerCalls < ' a > for MiriCompilerCalls {
@@ -80,8 +78,8 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
80
78
let mut control = self . default . build_controller ( sess, matches) ;
81
79
control. after_hir_lowering . callback = Box :: new ( after_hir_lowering) ;
82
80
control. after_analysis . callback = Box :: new ( after_analysis) ;
83
- if ! self . host_target {
84
- // only fully compile targets on the host
81
+ if sess . target . target != sess . host {
82
+ // only fully compile targets on the host. linking will fail for cross-compilation.
85
83
control. after_analysis . stop = Compilation :: Stop ;
86
84
}
87
85
control
@@ -258,18 +256,10 @@ fn main() {
258
256
args. push ( find_sysroot ( ) ) ;
259
257
}
260
258
261
- // for auxilary builds in unit tests
259
+ // Make sure we always have all the MIR (e.g. for auxilary builds in unit tests).
262
260
args. push ( "-Zalways-encode-mir" . to_owned ( ) ) ;
263
- let mut host_target = false ;
264
- args. retain ( |arg| if arg == "--miri_host_target" {
265
- host_target = true ;
266
- false // remove the flag, rustc doesn't know it
267
- } else {
268
- true
269
- } ) ;
270
261
271
262
rustc_driver:: run_compiler ( & args, & mut MiriCompilerCalls {
272
263
default : RustcDefaultCalls ,
273
- host_target,
274
264
} , None , None ) ;
275
265
}
0 commit comments