@@ -22,8 +22,6 @@ use std::path::PathBuf;
2222
2323struct  MiriCompilerCalls  { 
2424    default :  RustcDefaultCalls , 
25-     /// whether we are building for the host 
26- host_target :  bool , 
2725} 
2826
2927impl < ' a >  CompilerCalls < ' a >  for  MiriCompilerCalls  { 
@@ -80,8 +78,8 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
8078        let  mut  control = self . default . build_controller ( sess,  matches) ; 
8179        control. after_hir_lowering . callback  = Box :: new ( after_hir_lowering) ; 
8280        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.  
8583            control. after_analysis . stop  = Compilation :: Stop ; 
8684        } 
8785        control
@@ -258,18 +256,10 @@ fn main() {
258256        args. push ( find_sysroot ( ) ) ; 
259257    } 
260258
261-     // for auxilary builds in unit tests 
259+     // Make sure we always have all the MIR (e.g.  for auxilary builds in unit tests).  
262260    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-     } ) ; 
270261
271262    rustc_driver:: run_compiler ( & args,  & mut  MiriCompilerCalls  { 
272263        default :  RustcDefaultCalls , 
273-         host_target, 
274264    } ,  None ,  None ) ; 
275265} 
0 commit comments