about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-08-03 11:37:43 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-08-03 11:37:43 +0000
commit7956dbdcd15c562d6fed7bc5cd58f62874a67112 (patch)
tree60d262e9e8f36f7642504e69447600497f56c623 /src
parent460e92b6a9108ae3a8d020022d8dac2c73ba1904 (diff)
downloadrust-7956dbdcd15c562d6fed7bc5cd58f62874a67112.tar.gz
rust-7956dbdcd15c562d6fed7bc5cd58f62874a67112.zip
Avoid infinite recursion for auto-fmt and auto-clippy
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/miri-script/src/commands.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs
index 3e0d4c2c1d0..8e3e82854bf 100644
--- a/src/tools/miri/miri-script/src/commands.rs
+++ b/src/tools/miri/miri-script/src/commands.rs
@@ -58,7 +58,7 @@ impl MiriEnv {
 impl Command {
     fn auto_actions() -> Result<()> {
         let miri_dir = miri_dir()?;
-        let auto_everything = path!(miri_dir / ".auto_everything").exists();
+        let auto_everything = path!(miri_dir / ".auto-everything").exists();
         let auto_toolchain = auto_everything || path!(miri_dir / ".auto-toolchain").exists();
         let auto_fmt = auto_everything || path!(miri_dir / ".auto-fmt").exists();
         let auto_clippy = auto_everything || path!(miri_dir / ".auto-clippy").exists();
@@ -78,6 +78,21 @@ impl Command {
     }
 
     pub fn exec(self) -> Result<()> {
+        match &self {
+            Command::Install { .. }
+            | Command::Build { .. }
+            | Command::Check { .. }
+            | Command::Test { .. }
+            | Command::Run { .. }
+            | Command::Fmt { .. }
+            | Command::Clippy { .. }
+            | Command::Cargo { .. } => Self::auto_actions()?,
+            | Command::ManySeeds { .. }
+            | Command::Toolchain { .. }
+            | Command::RustcPull { .. }
+            | Command::Bench { .. }
+            | Command::RustcPush { .. } => {}
+        }
         match self {
             Command::Install { flags } => Self::install(flags),
             Command::Build { flags } => Self::build(flags),
@@ -328,7 +343,6 @@ impl Command {
     }
 
     fn install(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let e = MiriEnv::new()?;
         e.install_to_sysroot(e.miri_dir.clone(), &flags)?;
         e.install_to_sysroot(path!(e.miri_dir / "cargo-miri"), &flags)?;
@@ -336,7 +350,6 @@ impl Command {
     }
 
     fn build(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let e = MiriEnv::new()?;
         e.build(path!(e.miri_dir / "Cargo.toml"), &flags, /* quiet */ false)?;
         e.build(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags, /* quiet */ false)?;
@@ -344,7 +357,6 @@ impl Command {
     }
 
     fn check(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let e = MiriEnv::new()?;
         e.check(path!(e.miri_dir / "Cargo.toml"), &flags)?;
         e.check(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
@@ -352,7 +364,6 @@ impl Command {
     }
 
     fn clippy(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let e = MiriEnv::new()?;
         e.clippy(path!(e.miri_dir / "Cargo.toml"), &flags)?;
         e.clippy(path!(e.miri_dir / "cargo-miri" / "Cargo.toml"), &flags)?;
@@ -361,7 +372,6 @@ impl Command {
     }
 
     fn cargo(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         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
@@ -371,7 +381,6 @@ impl Command {
     }
 
     fn test(bless: bool, flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let mut e = MiriEnv::new()?;
         // Prepare a sysroot.
         e.build_miri_sysroot(/* quiet */ false)?;
@@ -386,7 +395,6 @@ impl Command {
     }
 
     fn run(dep: bool, flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let mut e = MiriEnv::new()?;
         // Scan for "--target" to overwrite the "MIRI_TEST_TARGET" env var so
         // that we set the MIRI_SYSROOT up the right way.
@@ -424,7 +432,6 @@ impl Command {
     }
 
     fn fmt(flags: Vec<OsString>) -> Result<()> {
-        Self::auto_actions()?;
         let e = MiriEnv::new()?;
         let toolchain = &e.toolchain;
         let config_path = path!(e.miri_dir / "rustfmt.toml");