Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8fdb720

Browse files
committed
Auto merge of rust-lang#2430 - RalfJung:no-global-wrapper, r=RalfJung
attempt to overwrite globally set build.rustc-wrapper Hopefully fixes rust-lang/miri#2429
2 parents 17bb2c0 + 7267e0d commit 8fdb720

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

cargo-miri/bin.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -494,19 +494,20 @@ path = "lib.rs"
494494
// The `MIRI_CALLED_FROM_XARGO` will mean we dispatch to `phase_setup_rustc`.
495495
let cargo_miri_path = std::env::current_exe().expect("current executable path invalid");
496496
if env::var_os("RUSTC_STAGE").is_some() {
497+
assert!(env::var_os("RUSTC").is_some());
497498
command.env("RUSTC_REAL", &cargo_miri_path);
498499
} else {
499500
command.env("RUSTC", &cargo_miri_path);
500501
}
501502
command.env("MIRI_CALLED_FROM_XARGO", "1");
502-
// Make sure there are no other wrappers or flags getting in our way
503-
// (Cc https://github.com/rust-lang/miri/issues/1421).
504-
// This is consistent with normal `cargo build` that does not apply `RUSTFLAGS`
505-
// to the sysroot either.
506-
command.env_remove("RUSTC_WRAPPER");
507-
command.env_remove("RUSTFLAGS");
508-
// Disable debug assertions in the standard library -- Miri is already slow enough.
509-
// But keep the overflow checks, they are cheap.
503+
// Make sure there are no other wrappers getting in our way
504+
// (Cc https://github.com/rust-lang/miri/issues/1421, https://github.com/rust-lang/miri/issues/2429).
505+
// Looks like setting `RUSTC_WRAPPER` to the empty string overwrites `build.rustc-wrapper` set via `config.toml`.
506+
command.env("RUSTC_WRAPPER", "");
507+
// Disable debug assertions in the standard library -- Miri is already slow enough. But keep the
508+
// overflow checks, they are cheap. This completely overwrites flags the user might have set,
509+
// which is consistent with normal `cargo build` that does not apply `RUSTFLAGS` to the sysroot
510+
// either.
510511
command.env("RUSTFLAGS", "-Cdebug-assertions=off -Coverflow-checks=on");
511512
// Manage the output the user sees.
512513
if only_setup {

ci.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,21 @@ function run_tests {
3838
else
3939
PYTHON=python
4040
fi
41+
# Some environment setup that attempts to confuse the heck out of cargo-miri.
42+
if [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
43+
# These act up on Windows (`which miri` produces a filename that does not exist?!?),
44+
# so let's do this only on Linux. Also makes sure things work without these set.
45+
export RUSTC=$(which rustc)
46+
export MIRI=$(which miri)
47+
fi
48+
mkdir -p .cargo
49+
echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
50+
# Run the actual test
4151
${PYTHON} test-cargo-miri/run-test.py
4252
echo
53+
# Clean up
54+
unset RUSTC MIRI
55+
rm -rf .cargo
4356

4457
# Ensure that our benchmarks all work, on the host at least.
4558
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then

0 commit comments

Comments
 (0)