Skip to content

Commit 8bddd6a

Browse files
authored
Merge pull request #344 from RalfJung/test
get rid of the --miri_host_target hack
2 parents 605c82b + 5a5aa49 commit 8bddd6a

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

miri/bin/miri.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use std::path::PathBuf;
2222

2323
struct MiriCompilerCalls {
2424
default: RustcDefaultCalls,
25-
/// whether we are building for the host
26-
host_target: bool,
2725
}
2826

2927
impl<'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
}

tests/compiletest.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
122122
// For now, only validate without optimizations. Inlining breaks validation.
123123
flags.push("-Zmir-emit-validate=1".to_owned());
124124
}
125-
if target == host {
126-
flags.push("--miri_host_target".to_owned());
127-
}
128125
config.target_rustcflags = Some(flags.join(" "));
129126
compiletest::run_tests(&config);
130127
}

0 commit comments

Comments
 (0)