]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/builder.rs
Rollup merge of #89422 - GuillaumeGomez:doctest-whitespace-name, r=CraftSpider
[rust.git] / src / bootstrap / builder.rs
index 0a6ed2f49b7877dcc19549b8571ed592509ffbfc..1f2109879d121bc452264f42afbf8f60dae5fecf 100644 (file)
@@ -1617,6 +1617,22 @@ pub(crate) fn ensure_if_default<T, S: Step<Output = Option<T>>>(
         // Only execute if it's supposed to run as default
         if desc.default && should_run.is_really_default() { self.ensure(step) } else { None }
     }
+
+    /// Checks if any of the "should_run" paths is in the `Builder` paths.
+    pub(crate) fn was_invoked_explicitly<S: Step>(&'a self) -> bool {
+        let desc = StepDescription::from::<S>();
+        let should_run = (desc.should_run)(ShouldRun::new(self));
+
+        for path in &self.paths {
+            if should_run.paths.iter().any(|s| s.has(path))
+                && !desc.is_excluded(self, &PathSet::Suite(path.clone()))
+            {
+                return true;
+            }
+        }
+
+        false
+    }
 }
 
 #[cfg(test)]