Skip to content

Commit f1b4a1d

Browse files
committed
Remove the build script for miri
Setting the TARGET env var can be replaced with using rustc_session::config::host_tuple at runtime. And the check-cfg can be replaced with using the lints section in Cargo.toml.
1 parent 09e0696 commit f1b4a1d

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/tools/miri/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ default = ["stack-cache"]
6767
stack-cache = []
6868
stack-cache-consistency-check = ["stack-cache"]
6969

70+
[lints.rust.unexpected_cfgs]
71+
level = "warn"
72+
check-cfg = ['cfg(bootstrap)']
73+
7074
# Be aware that this file is inside a workspace when used via the
7175
# submodule in the rustc repo. That means there are many cargo features
7276
# we cannot use, such as profiles.

src/tools/miri/build.rs

-10
This file was deleted.

src/tools/miri/src/machine.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,13 @@ impl<'tcx> MiriMachine<'tcx> {
713713
clock: Clock::new(config.isolated_op == IsolatedOp::Allow),
714714
#[cfg(unix)]
715715
native_lib: config.native_lib.as_ref().map(|lib_file_path| {
716+
let host_triple = rustc_session::config::host_tuple();
716717
let target_triple = tcx.sess.opts.target_triple.tuple();
717718
// Check if host target == the session target.
718-
if env!("TARGET") != target_triple {
719+
if host_triple != target_triple {
719720
panic!(
720721
"calling external C functions in linked .so file requires host and target to be the same: host={}, target={}",
721-
env!("TARGET"),
722+
host_triple,
722723
target_triple,
723724
);
724725
}

0 commit comments

Comments
 (0)