From 392342fcaf4c08c060d7ea7db2c03f3b5830def9 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 21 Jul 2022 11:45:22 +0000 Subject: [PATCH 1/3] Avoid rustformatting on autosave --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47864d822c4..f6147bbbe53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -168,11 +168,15 @@ to `.vscode/settings.json` in your local Miri clone: "./cargo-miri/Cargo.toml" ], "rust-analyzer.checkOnSave.overrideCommand": [ + "env", + "AUTO_OPS=42", "./miri", "check", "--message-format=json" ], "rust-analyzer.buildScripts.overrideCommand": [ + "env", + "AUTO_OPS=42", "./miri", "check", "--message-format=json", From bfa2ff646c5830de1662576658f4ae69e207ffca Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 21 Jul 2022 12:24:13 +0000 Subject: [PATCH 2/3] Use a MIRI namespaced env var name for auto ops --- CONTRIBUTING.md | 4 ++-- miri | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6147bbbe53..42f77b5cbc0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -169,14 +169,14 @@ to `.vscode/settings.json` in your local Miri clone: ], "rust-analyzer.checkOnSave.overrideCommand": [ "env", - "AUTO_OPS=42", + "MIRI_AUTO_OPS=no", "./miri", "check", "--message-format=json" ], "rust-analyzer.buildScripts.overrideCommand": [ "env", - "AUTO_OPS=42", + "MIRI_AUTO_OPS=no", "./miri", "check", "--message-format=json", diff --git a/miri b/miri index 38f8e546aec..463e4607bae 100755 --- a/miri +++ b/miri @@ -53,8 +53,8 @@ EOF MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0") ## Run the auto-things. -if [ -z "$AUTO_OPS" ]; then - export AUTO_OPS=42 +if [ -z "$MIRI_AUTO_OPS" ]; then + export MIRI_AUTO_OPS=42 # Run this first, so that the toolchain doesn't change after # other code has run. From 9e7f3cdc36fdef06647f5c35a91dc4631f0b92d7 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 21 Jul 2022 15:07:07 +0000 Subject: [PATCH 3/3] Document MIRI_AUTO_OPS --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index d1dde153c47..2214bcf4c59 100644 --- a/README.md +++ b/README.md @@ -393,6 +393,9 @@ 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 rustup-toolchain + 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. * `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