fix MIRI_AUTO_OPS not having an effect any more

This commit is contained in:
Ralf Jung 2023-08-21 09:38:06 +02:00
parent 5615562b68
commit 2f6ffa923e
2 changed files with 8 additions and 2 deletions

View File

@ -458,8 +458,8 @@ 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 toolchain setup
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.
should be skipped. If it is set to `no`, they are skipped. This is used 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

View File

@ -57,6 +57,10 @@ impl MiriEnv {
impl Command {
fn auto_actions() -> Result<()> {
if env::var_os("MIRI_AUTO_OPS").is_some_and(|x| x == "no") {
return Ok(());
}
let miri_dir = miri_dir()?;
let auto_everything = path!(miri_dir / ".auto-everything").exists();
let auto_toolchain = auto_everything || path!(miri_dir / ".auto-toolchain").exists();
@ -78,6 +82,7 @@ impl Command {
}
pub fn exec(self) -> Result<()> {
// First, and crucially only once, run the auto-actions -- but not for all commands.
match &self {
Command::Install { .. }
| Command::Build { .. }
@ -93,6 +98,7 @@ impl Command {
| Command::Bench { .. }
| Command::RustcPush { .. } => {}
}
// Then run the actual command.
match self {
Command::Install { flags } => Self::install(flags),
Command::Build { flags } => Self::build(flags),