about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-02-14 15:10:22 +0000
committerGitHub <noreply@github.com>2025-02-14 15:10:22 +0000
commit17f218dcbef5aaa8cc0d0c3e3e4bd7d6fab82aea (patch)
tree6a9e398612e3d76fd4c67449870100b7c3f0141c
parent09e0696586800ffd15448576260160161c80c655 (diff)
parentf1b4a1d0d135f4aa8c338b1dc98b8296c972ce69 (diff)
downloadrust-17f218dcbef5aaa8cc0d0c3e3e4bd7d6fab82aea.tar.gz
rust-17f218dcbef5aaa8cc0d0c3e3e4bd7d6fab82aea.zip
Merge pull request #4192 from bjorn3/no_build_script
Remove the build script for miri
-rw-r--r--src/tools/miri/Cargo.toml4
-rw-r--r--src/tools/miri/build.rs10
-rw-r--r--src/tools/miri/src/machine.rs5
3 files changed, 7 insertions, 12 deletions
diff --git a/src/tools/miri/Cargo.toml b/src/tools/miri/Cargo.toml
index de80722fc3d..728a7552fd8 100644
--- a/src/tools/miri/Cargo.toml
+++ b/src/tools/miri/Cargo.toml
@@ -67,6 +67,10 @@ default = ["stack-cache"]
 stack-cache = []
 stack-cache-consistency-check = ["stack-cache"]
 
+[lints.rust.unexpected_cfgs]
+level = "warn"
+check-cfg = ['cfg(bootstrap)']
+
 # Be aware that this file is inside a workspace when used via the
 # submodule in the rustc repo. That means there are many cargo features
 # we cannot use, such as profiles.
diff --git a/src/tools/miri/build.rs b/src/tools/miri/build.rs
deleted file mode 100644
index 0918c9b1321..00000000000
--- a/src/tools/miri/build.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() {
-    // Don't rebuild miri when nothing changed.
-    println!("cargo:rerun-if-changed=build.rs");
-    // Re-export the TARGET environment variable so it can be accessed by miri. Needed to know the
-    // "host" triple inside Miri.
-    let target = std::env::var("TARGET").unwrap();
-    println!("cargo:rustc-env=TARGET={target}");
-    // Allow some cfgs.
-    println!("cargo::rustc-check-cfg=cfg(bootstrap)");
-}
diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs
index 6bd1076a8a8..4ece8f7895d 100644
--- a/src/tools/miri/src/machine.rs
+++ b/src/tools/miri/src/machine.rs
@@ -713,12 +713,13 @@ impl<'tcx> MiriMachine<'tcx> {
             clock: Clock::new(config.isolated_op == IsolatedOp::Allow),
             #[cfg(unix)]
             native_lib: config.native_lib.as_ref().map(|lib_file_path| {
+                let host_triple = rustc_session::config::host_tuple();
                 let target_triple = tcx.sess.opts.target_triple.tuple();
                 // Check if host target == the session target.
-                if env!("TARGET") != target_triple {
+                if host_triple != target_triple {
                     panic!(
                         "calling external C functions in linked .so file requires host and target to be the same: host={}, target={}",
-                        env!("TARGET"),
+                        host_triple,
                         target_triple,
                     );
                 }