From 120467c12f8361595f96a18c8bccce92d79d7beb Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 9 Aug 2024 23:59:40 +0200 Subject: [PATCH] update suggested RA config; the './miri cargo' command is not needed any more --- CONTRIBUTING.md | 8 ++++---- miri-script/src/commands.rs | 13 +------------ miri-script/src/main.rs | 4 ---- miri-script/src/util.rs | 2 +- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8aca8d459d..1c76354eae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -173,24 +173,24 @@ to `.vscode/settings.json` in your local Miri clone: "cargo-miri/Cargo.toml", "miri-script/Cargo.toml", ], + "rust-analyzer.check.invocationLocation": "root", + "rust-analyzer.check.invocationStrategy": "once", "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", - "--all-targets", ], // Contrary to what the name suggests, this also affects proc macros. + "rust-analyzer.cargo.buildScripts.invocationLocation": "root", + "rust-analyzer.cargo.buildScripts.invocationStrategy": "once", "rust-analyzer.cargo.buildScripts.overrideCommand": [ "env", "MIRI_AUTO_OPS=no", "./miri", - "cargo", "check", "--message-format=json", - "--all-targets", ], } ``` diff --git a/miri-script/src/commands.rs b/miri-script/src/commands.rs index 705ddaa9ea..d4e86b05fe 100644 --- a/miri-script/src/commands.rs +++ b/miri-script/src/commands.rs @@ -153,8 +153,7 @@ impl Command { | Command::Test { .. } | Command::Run { .. } | Command::Fmt { .. } - | Command::Clippy { .. } - | Command::Cargo { .. } => Self::auto_actions()?, + | Command::Clippy { .. } => Self::auto_actions()?, | Command::Toolchain { .. } | Command::Bench { .. } | Command::RustcPull { .. } @@ -170,7 +169,6 @@ impl Command { Self::run(dep, verbose, many_seeds, target, edition, flags), Command::Fmt { flags } => Self::fmt(flags), Command::Clippy { flags } => Self::clippy(flags), - Command::Cargo { flags } => Self::cargo(flags), Command::Bench { target, benches } => Self::bench(target, benches), Command::Toolchain { flags } => Self::toolchain(flags), Command::RustcPull { commit } => Self::rustc_pull(commit.clone()), @@ -449,15 +447,6 @@ impl Command { Ok(()) } - fn cargo(flags: Vec) -> Result<()> { - let e = MiriEnv::new()?; - let toolchain = &e.toolchain; - // We carefully kept the working dir intact, so this will run cargo *on the workspace in the - // current working dir*, not on the main Miri workspace. That is exactly what RA needs. - cmd!(e.sh, "cargo +{toolchain} {flags...}").run()?; - Ok(()) - } - fn test(bless: bool, mut flags: Vec, target: Option) -> Result<()> { let mut e = MiriEnv::new()?; diff --git a/miri-script/src/main.rs b/miri-script/src/main.rs index c4f0d808d9..1e181cad08 100644 --- a/miri-script/src/main.rs +++ b/miri-script/src/main.rs @@ -58,9 +58,6 @@ pub enum Command { /// Flags that are passed through to `cargo clippy`. flags: Vec, }, - /// Runs just `cargo ` with the Miri-specific environment variables. - /// Mainly meant to be invoked by rust-analyzer. - Cargo { flags: Vec }, /// Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed. Bench { target: Option, @@ -205,7 +202,6 @@ fn main() -> Result<()> { } Some("fmt") => Command::Fmt { flags: args.remainder() }, Some("clippy") => Command::Clippy { flags: args.remainder() }, - Some("cargo") => Command::Cargo { flags: args.remainder() }, Some("install") => Command::Install { flags: args.remainder() }, Some("bench") => { let mut target = None; diff --git a/miri-script/src/util.rs b/miri-script/src/util.rs index 568dc1ec0b..df7c206a5b 100644 --- a/miri-script/src/util.rs +++ b/miri-script/src/util.rs @@ -33,7 +33,7 @@ pub struct MiriEnv { /// miri_dir is the root of the miri repository checkout we are working in. pub miri_dir: PathBuf, /// active_toolchain is passed as `+toolchain` argument to cargo/rustc invocations. - pub toolchain: String, + toolchain: String, /// Extra flags to pass to cargo. cargo_extra_flags: Vec, /// The rustc sysroot