diff options
| -rw-r--r-- | src/tools/miri/CONTRIBUTING.md | 9 | ||||
| -rw-r--r-- | src/tools/miri/README.md | 4 | ||||
| -rw-r--r-- | src/tools/miri/miri-script/src/commands.rs | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/tools/miri/CONTRIBUTING.md b/src/tools/miri/CONTRIBUTING.md index b67e7103fd0..60ba2cd2346 100644 --- a/src/tools/miri/CONTRIBUTING.md +++ b/src/tools/miri/CONTRIBUTING.md @@ -165,16 +165,17 @@ to `.vscode/settings.json` in your local Miri clone: { "rust-analyzer.rustc.source": "discover", "rust-analyzer.linkedProjects": [ - "./Cargo.toml", - "./cargo-miri/Cargo.toml" + "Cargo.toml", + "cargo-miri/Cargo.toml", + "miri-script/Cargo.toml", ], - "rust-analyzer.checkOnSave.overrideCommand": [ + "rust-analyzer.check.overrideCommand": [ "env", "MIRI_AUTO_OPS=no", "./miri", "cargo", "clippy", // make this `check` when working with a locally built rustc - "--message-format=json" + "--message-format=json", ], // Contrary to what the name suggests, this also affects proc macros. "rust-analyzer.cargo.buildScripts.overrideCommand": [ diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 4483ae242d5..06fe668354a 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -458,8 +458,8 @@ Some native rustc `-Z` flags are also very relevant for Miri: Moreover, Miri recognizes some environment variables: * `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup - should be skipped. If it is set to any value, they are skipped. This is used for avoiding infinite - recursion in `./miri` and to allow automated IDE actions to avoid the auto ops. + should be skipped. If it is set to `no`, they are skipped. This is used to allow automated IDE + actions to avoid the auto ops. * `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during Miri executions, also [see "Testing the Miri driver" in `CONTRIBUTING.md`][testing-miri]. * `MIRIFLAGS` (recognized by `cargo miri` and the test suite) defines extra diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index ed78f80c023..ebaef1fd475 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -57,6 +57,10 @@ impl MiriEnv { impl Command { fn auto_actions() -> Result<()> { + if env::var_os("MIRI_AUTO_OPS").is_some_and(|x| x == "no") { + return Ok(()); + } + let miri_dir = miri_dir()?; let auto_everything = path!(miri_dir / ".auto-everything").exists(); let auto_toolchain = auto_everything || path!(miri_dir / ".auto-toolchain").exists(); @@ -78,6 +82,7 @@ impl Command { } pub fn exec(self) -> Result<()> { + // First, and crucially only once, run the auto-actions -- but not for all commands. match &self { Command::Install { .. } | Command::Build { .. } @@ -93,6 +98,7 @@ impl Command { | Command::Bench { .. } | Command::RustcPush { .. } => {} } + // Then run the actual command. match self { Command::Install { flags } => Self::install(flags), Command::Build { flags } => Self::build(flags), |
