forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#3798 - RalfJung:miri-script-remap-path-prefix…
…, r=saethlin miri-script: use --remap-path-prefix to print errors relative to the right root Inspired by rust-lang/rust-clippy#13232, this makes it so that when cargo-miri fails to build, `./miri check` will print errors with paths like `cargo-miri/src/setup.rs`. That means we can get rid of the miri-symlink-hacks and instead tell RA to just always invoke the `./miri clippy` script just once, in the root. This means that we can no longer share a target dir between cargo-miri and miri as the RUSTFLAGS are different to crates that are shared in the dependency tree need to be built twice with two different flags. `miri-script` hence now has to set the MIRI environment variable to tell the `cargo miri setup` invocation where to find Miri. I also made it so that errors in miri-script itself are properly shown in RA, for which the `./miri` shell wrapper needs to set the right flags.
- Loading branch information
Showing
12 changed files
with
135 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[unstable] | ||
profile-rustflags = true | ||
|
||
# Add back the containing directory of the packages we have to refer to using --manifest-path. | ||
# Per-package profiles avoid adding this to build dependencies. | ||
[profile.dev.package."cargo-miri"] | ||
rustflags = ["--remap-path-prefix", "=cargo-miri"] | ||
[profile.dev.package."miri-script"] | ||
rustflags = ["--remap-path-prefix", "=miri-script"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
# We want to call the binary directly, so we need to know where it ends up. | ||
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target | ||
# If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output. | ||
if ! [ -t 1 ] && [ -z "$CI" ]; then | ||
MESSAGE_FORMAT="--message-format=json" | ||
fi | ||
# We need a nightly toolchain, for the `profile-rustflags` cargo feature. | ||
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml \ | ||
-q --target-dir "$MIRI_SCRIPT_TARGET_DIR" $MESSAGE_FORMAT || \ | ||
( echo "Failed to build miri-script. Is the 'nightly' toolchain installed?"; exit 1 ) | ||
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through | ||
# rustup (that sets it's own environmental variables), which is undesirable. | ||
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target | ||
cargo +stable build $CARGO_EXTRA_FLAGS -q --target-dir "$MIRI_SCRIPT_TARGET_DIR" --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml || \ | ||
( echo "Failed to build miri-script. Is the 'stable' toolchain installed?"; exit 1 ) | ||
"$MIRI_SCRIPT_TARGET_DIR"/debug/miri-script "$@" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.