Skip to content

Commit a5ba57e

Browse files
committed
Auto merge of rust-lang#3034 - RalfJung:ra, r=RalfJung
update recommended RA config Looks like rust-analyzer.checkOnSave.overrideCommand got renamed to rust-analyzer.check.overrideCommand.
2 parents 83ca922 + 2f6ffa9 commit a5ba57e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/tools/miri/CONTRIBUTING.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,17 @@ to `.vscode/settings.json` in your local Miri clone:
165165
{
166166
"rust-analyzer.rustc.source": "discover",
167167
"rust-analyzer.linkedProjects": [
168-
"./Cargo.toml",
169-
"./cargo-miri/Cargo.toml"
168+
"Cargo.toml",
169+
"cargo-miri/Cargo.toml",
170+
"miri-script/Cargo.toml",
170171
],
171-
"rust-analyzer.checkOnSave.overrideCommand": [
172+
"rust-analyzer.check.overrideCommand": [
172173
"env",
173174
"MIRI_AUTO_OPS=no",
174175
"./miri",
175176
"cargo",
176177
"clippy", // make this `check` when working with a locally built rustc
177-
"--message-format=json"
178+
"--message-format=json",
178179
],
179180
// Contrary to what the name suggests, this also affects proc macros.
180181
"rust-analyzer.cargo.buildScripts.overrideCommand": [

src/tools/miri/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ Some native rustc `-Z` flags are also very relevant for Miri:
458458
Moreover, Miri recognizes some environment variables:
459459

460460
* `MIRI_AUTO_OPS` indicates whether the automatic execution of rustfmt, clippy and toolchain setup
461-
should be skipped. If it is set to any value, they are skipped. This is used for avoiding infinite
462-
recursion in `./miri` and to allow automated IDE actions to avoid the auto ops.
461+
should be skipped. If it is set to `no`, they are skipped. This is used to allow automated IDE
462+
actions to avoid the auto ops.
463463
* `MIRI_LOG`, `MIRI_BACKTRACE` control logging and backtrace printing during
464464
Miri executions, also [see "Testing the Miri driver" in `CONTRIBUTING.md`][testing-miri].
465465
* `MIRIFLAGS` (recognized by `cargo miri` and the test suite) defines extra

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

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ impl MiriEnv {
5757

5858
impl Command {
5959
fn auto_actions() -> Result<()> {
60+
if env::var_os("MIRI_AUTO_OPS").is_some_and(|x| x == "no") {
61+
return Ok(());
62+
}
63+
6064
let miri_dir = miri_dir()?;
6165
let auto_everything = path!(miri_dir / ".auto-everything").exists();
6266
let auto_toolchain = auto_everything || path!(miri_dir / ".auto-toolchain").exists();
@@ -78,6 +82,7 @@ impl Command {
7882
}
7983

8084
pub fn exec(self) -> Result<()> {
85+
// First, and crucially only once, run the auto-actions -- but not for all commands.
8186
match &self {
8287
Command::Install { .. }
8388
| Command::Build { .. }
@@ -93,6 +98,7 @@ impl Command {
9398
| Command::Bench { .. }
9499
| Command::RustcPush { .. } => {}
95100
}
101+
// Then run the actual command.
96102
match self {
97103
Command::Install { flags } => Self::install(flags),
98104
Command::Build { flags } => Self::build(flags),

0 commit comments

Comments
 (0)