Skip to content

Commit 3f952f4

Browse files
committed
miri-script refactor
1 parent 7f2eca6 commit 3f952f4

File tree

10 files changed

+553
-614
lines changed

10 files changed

+553
-614
lines changed

src/tools/miri/.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- name: clippy
131131
run: ./miri clippy -- -D warnings
132132
- name: rustdoc
133-
run: RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items
133+
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
134134

135135
# These jobs doesn't actually test anything, but they're only used to tell
136136
# bors the build completed, as there is no practical way to detect when a

src/tools/miri/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ evaluation error was originally raised.
107107
### UI testing
108108

109109
We use ui-testing in Miri, meaning we generate `.stderr` and `.stdout` files for the output
110-
produced by Miri. You can use `./miri bless` to automatically (re)generate these files when
110+
produced by Miri. You can use `./miri test --bless` to automatically (re)generate these files when
111111
you add new tests or change how Miri presents certain output.
112112

113113
Note that when you also use `MIRIFLAGS` to change optimizations and similar, the ui output

src/tools/miri/cargo-miri/src/phases.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,7 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
538538
}
539539
// Respect `MIRIFLAGS`.
540540
if let Ok(a) = env::var("MIRIFLAGS") {
541-
// This code is taken from `RUSTFLAGS` handling in cargo.
542-
let args = a.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string);
541+
let args = flagsplit(&a);
543542
cmd.args(args);
544543
}
545544

src/tools/miri/cargo-miri/src/util.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ pub fn cargo() -> Command {
114114
Command::new(env::var_os("CARGO").unwrap_or_else(|| OsString::from("cargo")))
115115
}
116116

117+
pub fn flagsplit(flags: &str) -> Vec<String> {
118+
// This code is taken from `RUSTFLAGS` handling in cargo.
119+
flags.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect()
120+
}
121+
117122
/// Execute the `Command`, where possible by replacing the current process with a new process
118123
/// described by the `Command`. Then exit this process with the exit code of the new process.
119124
pub fn exec(mut cmd: Command) -> ! {

src/tools/miri/miri

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
set -e
33
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through
44
# rustup (that sets it's own environmental variables), which is undesirable.
5-
cargo build --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
6-
"$(dirname "$0")"/miri-script/target/debug/miri-script $@
5+
cargo build -q --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
6+
"$(dirname "$0")"/miri-script/target/debug/miri-script "$@"

src/tools/miri/miri-script/miri

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# RA invokes `./miri cargo ...` for each workspace, so we need to forward that to the main `miri`
3+
# script. See <https://github.com/rust-analyzer/rust-analyzer/issues/10793>.
4+
exec "$(dirname "$0")"/../miri "$@"

src/tools/miri/miri-script/src/arg.rs

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)