1
Fork 0

add ./miri cargo for RA to invoke

This commit is contained in:
Ralf Jung 2022-08-19 08:01:38 -04:00
parent 09118da54f
commit 0c3ad68a5a
3 changed files with 15 additions and 3 deletions

View file

@ -171,7 +171,8 @@ to `.vscode/settings.json` in your local Miri clone:
"env", "env",
"MIRI_AUTO_OPS=no", "MIRI_AUTO_OPS=no",
"./miri", "./miri",
"check", "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. // Contrary to what the name suggests, this also affects proc macros.
@ -179,6 +180,7 @@ to `.vscode/settings.json` in your local Miri clone:
"env", "env",
"MIRI_AUTO_OPS=no", "MIRI_AUTO_OPS=no",
"./miri", "./miri",
"cargo",
"check", "check",
"--message-format=json", "--message-format=json",
], ],

View file

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
# Hack to work around https://github.com/rust-analyzer/rust-analyzer/issues/10793. # RA invokes `./miri cargo ...` for each workspace, so we need to forward that to the main `miri`
# script. See <https://github.com/rust-analyzer/rust-analyzer/issues/10793>.
exec "$(dirname "$0")"/../miri "$@" exec "$(dirname "$0")"/../miri "$@"

11
miri
View file

@ -29,6 +29,10 @@ Format all sources and tests. <flags> are passed to `rustfmt`.
./miri clippy <flags>: ./miri clippy <flags>:
Runs clippy on all sources. <flags> are passed to `cargo clippy`. Runs clippy on all sources. <flags> are passed to `cargo clippy`.
./miri cargo <flags>:
Runs just `cargo <flags>` with the Miri-specific environment variables.
Mainly meant to be invoked by rust-analyzer.
./miri many-seeds <command>: ./miri many-seeds <command>:
Runs <command> over and over again with different seeds for Miri. The MIRIFLAGS Runs <command> over and over again with different seeds for Miri. The MIRIFLAGS
variable is set to its original value appended with ` -Zmiri-seed=$SEED` for variable is set to its original value appended with ` -Zmiri-seed=$SEED` for
@ -44,7 +48,7 @@ MIRI_SYSROOT:
If already set, the "sysroot setup" step is skipped. If already set, the "sysroot setup" step is skipped.
CARGO_EXTRA_FLAGS: CARGO_EXTRA_FLAGS:
Pass extra flags to all cargo invocations. Pass extra flags to all cargo invocations. (Ignored by `./miri cargo`.)
EOF EOF
) )
@ -218,6 +222,11 @@ clippy)
$CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/ui_test/Cargo.toml --all-targets "$@" $CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/ui_test/Cargo.toml --all-targets "$@"
$CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/cargo-miri/Cargo.toml "$@" $CARGO clippy $CARGO_EXTRA_FLAGS --manifest-path "$MIRIDIR"/cargo-miri/Cargo.toml "$@"
;; ;;
cargo)
# 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.
$CARGO "$@"
;;
*) *)
if [ -n "$COMMAND" ]; then if [ -n "$COMMAND" ]; then
echo "Unknown command: $COMMAND" echo "Unknown command: $COMMAND"