Skip to content

Commit d2e0970

Browse files
committed
update suggested RA config; the './miri cargo' command is not needed any more
1 parent f7c938a commit d2e0970

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

src/tools/miri/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,24 @@ to `.vscode/settings.json` in your local Miri clone:
173173
"cargo-miri/Cargo.toml",
174174
"miri-script/Cargo.toml",
175175
],
176+
"rust-analyzer.check.invocationLocation": "root",
177+
"rust-analyzer.check.invocationStrategy": "once",
176178
"rust-analyzer.check.overrideCommand": [
177179
"env",
178180
"MIRI_AUTO_OPS=no",
179181
"./miri",
180-
"cargo",
181182
"clippy", // make this `check` when working with a locally built rustc
182183
"--message-format=json",
183-
"--all-targets",
184184
],
185185
// Contrary to what the name suggests, this also affects proc macros.
186+
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
187+
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
186188
"rust-analyzer.cargo.buildScripts.overrideCommand": [
187189
"env",
188190
"MIRI_AUTO_OPS=no",
189191
"./miri",
190-
"cargo",
191192
"check",
192193
"--message-format=json",
193-
"--all-targets",
194194
],
195195
}
196196
```

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ impl Command {
153153
| Command::Test { .. }
154154
| Command::Run { .. }
155155
| Command::Fmt { .. }
156-
| Command::Clippy { .. }
157-
| Command::Cargo { .. } => Self::auto_actions()?,
156+
| Command::Clippy { .. } => Self::auto_actions()?,
158157
| Command::Toolchain { .. }
159158
| Command::Bench { .. }
160159
| Command::RustcPull { .. }
@@ -170,7 +169,6 @@ impl Command {
170169
Self::run(dep, verbose, many_seeds, target, edition, flags),
171170
Command::Fmt { flags } => Self::fmt(flags),
172171
Command::Clippy { flags } => Self::clippy(flags),
173-
Command::Cargo { flags } => Self::cargo(flags),
174172
Command::Bench { target, benches } => Self::bench(target, benches),
175173
Command::Toolchain { flags } => Self::toolchain(flags),
176174
Command::RustcPull { commit } => Self::rustc_pull(commit.clone()),
@@ -449,15 +447,6 @@ impl Command {
449447
Ok(())
450448
}
451449

452-
fn cargo(flags: Vec<String>) -> Result<()> {
453-
let e = MiriEnv::new()?;
454-
let toolchain = &e.toolchain;
455-
// We carefully kept the working dir intact, so this will run cargo *on the workspace in the
456-
// current working dir*, not on the main Miri workspace. That is exactly what RA needs.
457-
cmd!(e.sh, "cargo +{toolchain} {flags...}").run()?;
458-
Ok(())
459-
}
460-
461450
fn test(bless: bool, mut flags: Vec<String>, target: Option<String>) -> Result<()> {
462451
let mut e = MiriEnv::new()?;
463452

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ pub enum Command {
5858
/// Flags that are passed through to `cargo clippy`.
5959
flags: Vec<String>,
6060
},
61-
/// Runs just `cargo <flags>` with the Miri-specific environment variables.
62-
/// Mainly meant to be invoked by rust-analyzer.
63-
Cargo { flags: Vec<String> },
6461
/// Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed.
6562
Bench {
6663
target: Option<String>,
@@ -205,7 +202,6 @@ fn main() -> Result<()> {
205202
}
206203
Some("fmt") => Command::Fmt { flags: args.remainder() },
207204
Some("clippy") => Command::Clippy { flags: args.remainder() },
208-
Some("cargo") => Command::Cargo { flags: args.remainder() },
209205
Some("install") => Command::Install { flags: args.remainder() },
210206
Some("bench") => {
211207
let mut target = None;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct MiriEnv {
3333
/// miri_dir is the root of the miri repository checkout we are working in.
3434
pub miri_dir: PathBuf,
3535
/// active_toolchain is passed as `+toolchain` argument to cargo/rustc invocations.
36-
pub toolchain: String,
36+
toolchain: String,
3737
/// Extra flags to pass to cargo.
3838
cargo_extra_flags: Vec<String>,
3939
/// The rustc sysroot

0 commit comments

Comments
 (0)