Skip to content

Commit 1f10233

Browse files
committed
use -Zroot-dir instead of --remap-path-prefix for diagnostic dir handling
1 parent 64a3bb1 commit 1f10233

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

.cargo/config.toml

-9
This file was deleted.

miri

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env bash
22
set -e
33
# We want to call the binary directly, so we need to know where it ends up.
4-
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
4+
ROOT_DIR="$(dirname "$0")"
5+
MIRI_SCRIPT_TARGET_DIR="$ROOT_DIR"/miri-script/target
56
# If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output.
67
if ! [ -t 1 ] && [ -z "$CI" ]; then
78
MESSAGE_FORMAT="--message-format=json"
89
fi
9-
# We need a nightly toolchain, for the `profile-rustflags` cargo feature.
10-
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml \
10+
# We need a nightly toolchain, for `-Zroot-dir`.
11+
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$ROOT_DIR"/miri-script/Cargo.toml \
12+
-Zroot-dir="$ROOT_DIR" \
1113
-q --target-dir "$MIRI_SCRIPT_TARGET_DIR" $MESSAGE_FORMAT || \
1214
( echo "Failed to build miri-script. Is the 'nightly' toolchain installed?"; exit 1 )
1315
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through

miri-script/src/util.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,16 @@ impl MiriEnv {
105105

106106
// Get extra flags for cargo.
107107
let cargo_extra_flags = std::env::var("CARGO_EXTRA_FLAGS").unwrap_or_default();
108-
let cargo_extra_flags = flagsplit(&cargo_extra_flags);
108+
let mut cargo_extra_flags = flagsplit(&cargo_extra_flags);
109109
if cargo_extra_flags.iter().any(|a| a == "--release" || a.starts_with("--profile")) {
110110
// This makes binaries end up in different paths, let's not do that.
111111
eprintln!(
112112
"Passing `--release` or `--profile` in `CARGO_EXTRA_FLAGS` will totally confuse miri-script, please don't do that."
113113
);
114114
std::process::exit(1);
115115
}
116+
// Also set `-Zroot-dir` for cargo, to print diagnostics relative to the miri dir.
117+
cargo_extra_flags.push(format!("-Zroot-dir={}", miri_dir.display()));
116118

117119
Ok(MiriEnv { miri_dir, toolchain, sh, sysroot, cargo_extra_flags, libdir })
118120
}

0 commit comments

Comments
 (0)