Skip to content

Use miri inside the target directory used by rustc as Miri's target directory #1842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from Jul 3, 2021
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,13 @@ jobs:
rustup-toolchain-install-master \
-f \
-n master "$RUSTC_HASH" \
-c cargo \
-c rust-src \
-c rustc-dev \
-c llvm-tools \
--host ${{ matrix.host_target }}
rustup default master

# We need a nightly Cargo to run tests that depend on unstable Cargo features.
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly

- name: Show Rust version
run: |
rustup show
Expand Down
8 changes: 5 additions & 3 deletions cargo-miri/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn has_arg_flag(name: &str) -> bool {
}

/// Yields all values of command line flag `name` as `Ok(arg)`, and all other arguments except
/// the flag as `Err(arg)`.
/// the flag as `Err(arg)`. (The flag `name` itself is not yielded at all, only its values are.)
struct ArgSplitFlagValue<'a, I> {
args: TakeWhile<I, fn(&String) -> bool>,
name: &'a str,
Expand Down Expand Up @@ -500,7 +500,7 @@ fn detect_target_dir() -> PathBuf {
// Check this `Result` after `status.success()` is checked, so we don't print the error
// to stderr if `cargo metadata` is also printing to stderr.
let metadata: Result<Metadata, _> = serde_json::from_reader(child.stdout.take().unwrap());
let status = child.wait().expect("failed to wait `cargo metadata` to exit");
let status = child.wait().expect("failed to wait for `cargo metadata` to exit");
if !status.success() {
std::process::exit(status.code().unwrap_or(-1));
}
Expand Down Expand Up @@ -578,7 +578,9 @@ fn phase_cargo_miri(mut args: env::Args) {
}
target_dir = Some(value.into());
}
Err(arg) => drop(cmd.arg(arg)),
Err(arg) => {
cmd.arg(arg);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion rustup-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fi

# Install and setup new toolchain.
rustup toolchain uninstall miri
rustup-toolchain-install-master -n miri -c rust-src -c rustc-dev -c llvm-tools -- "$NEW_COMMIT"
rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools -- "$NEW_COMMIT"
rustup override set miri

# Cleanup.
Expand Down