From ca9d50982d4b2fd5abe09066afdadd57c674ff57 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Mon, 6 Mar 2023 21:30:16 -0500 Subject: [PATCH] Install binaries to the miri toolchain's sysroot --- src/tools/miri/ci.sh | 4 ++-- src/tools/miri/miri | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/miri/ci.sh b/src/tools/miri/ci.sh index 60450d098154..ef52a37fe319 100755 --- a/src/tools/miri/ci.sh +++ b/src/tools/miri/ci.sh @@ -62,8 +62,8 @@ function run_tests { if [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then # These act up on Windows (`which miri` produces a filename that does not exist?!?), # so let's do this only on Linux. Also makes sure things work without these set. - export RUSTC=$(which rustc) - export MIRI=$(which miri) + export RUSTC=$(which rustc) # Produces a warning unless we also set MIRI + export MIRI=$(rustc +miri --print sysroot)/bin/miri fi mkdir -p .cargo echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml diff --git a/src/tools/miri/miri b/src/tools/miri/miri index 0c0bbbc70208..998e0d295243 100755 --- a/src/tools/miri/miri +++ b/src/tools/miri/miri @@ -281,8 +281,9 @@ find_sysroot() { case "$COMMAND" in install) # "--locked" to respect the Cargo.lock file if it exists. - $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked "$@" - $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked "$@" + # Install binaries to the miri toolchain's sysroot so they do not interact with other toolchains + $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --root "$SYSROOT" "$@" + $CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --root "$SYSROOT" "$@" ;; check) # Check, and let caller control flags.