diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index f217cd1dd37b..8740d7a1eb30 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -70,7 +70,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { /// will execute. However, it does not get called in a "default" context /// when we are not passed any paths; in that case, make_run is called /// directly. - fn should_run(_builder: &Builder, _path: &Path) -> bool { false } + fn should_run(builder: &Builder, path: &Path) -> bool; /// Build up a "root" rule, either as a default rule or from a path passed /// to us. @@ -83,7 +83,13 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { _path: Option<&Path>, _host: Interned, _target: Interned, - ) { unimplemented!() } + ) { + // It is reasonable to not have an implementation of make_run for rules + // who do not want to get called from the root context. This means that + // they are likely dependencies (e.g., sysroot creation) or similar, and + // as such calling them from ./x.py isn't logical. + unimplemented!() + } } #[derive(Copy, Clone, PartialEq, Eq, Debug)] @@ -188,6 +194,11 @@ impl<'a> Builder<'a> { } impl Step for Libdir { type Output = Interned; + + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + fn run(self, builder: &Builder) -> Interned { let compiler = self.compiler; let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() { diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index d983e54ac085..b5d5d6de0843 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -1360,6 +1360,10 @@ pub struct RemoteCopyLibs { impl Step for RemoteCopyLibs { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + fn run(self, builder: &Builder) { let build = builder.build; let compiler = self.compiler; @@ -1411,6 +1415,10 @@ pub struct Distcheck; impl Step for Distcheck { type Output = (); + fn should_run(_builder: &Builder, path: &Path) -> bool { + path.ends_with("distcheck") + } + /// Run "distcheck", a 'make check' from a tarball fn run(self, builder: &Builder) { let build = builder.build; diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 558ced12cfea..86879454f089 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -276,6 +276,10 @@ struct StdLink { impl Step for StdLink { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Link all libstd rlibs/dylibs into the sysroot location. /// /// Links those artifacts generated by `compiler` to a the `stage` compiler's @@ -503,6 +507,10 @@ pub struct TestLink { impl Step for TestLink { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Same as `std_link`, only for libtest fn run(self, builder: &Builder) { let build = builder.build; @@ -691,6 +699,10 @@ struct RustcLink { impl Step for RustcLink { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Same as `std_link`, only for librustc fn run(self, builder: &Builder) { let build = builder.build; @@ -743,6 +755,10 @@ pub struct Sysroot { impl Step for Sysroot { type Output = Interned; + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Returns the sysroot for the `compiler` specified that *this build system /// generates*. /// @@ -789,6 +805,10 @@ pub struct Assemble { impl Step for Assemble { type Output = Compiler; + fn should_run(_builder: &Builder, path: &Path) -> bool { + path.ends_with("src/rustc") + } + /// Prepare a new compiler from the artifacts in `stage` /// /// This will assemble a compiler in `build/$host/stage$stage`. The compiler diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 0030b46b32e1..65110dbaae95 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -107,6 +107,12 @@ pub struct Rustbook { impl Step for Rustbook { type Output = (); + // rustbook is never directly called, and only serves as a shim for the nomicon and the + // reference. + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Invoke `rustbook` for `target` for the doc book `name`. /// /// This will not actually generate any documentation if the documentation has @@ -182,6 +188,11 @@ pub struct RustbookSrc { impl Step for RustbookSrc { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + // RustbookSrc is also never run directly, only as a helper to other rules + false + } + /// Invoke `rustbook` for `target` for the doc book `name` from the `src` path. /// /// This will not actually generate any documentation if the documentation has diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index c0ec693a17e6..b60a3760eb28 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -55,6 +55,10 @@ impl Step for Llvm { type Output = (); const ONLY_HOSTS: bool = true; + fn should_run(_builder: &Builder, path: &Path) -> bool { + path.ends_with("src/llvm") + } + /// Compile LLVM for `target`. fn run(self, builder: &Builder) { let build = builder.build; diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 00616caf1206..9c5592cd61bf 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -55,6 +55,10 @@ pub struct CleanTools { impl Step for CleanTools { type Output = (); + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Build a tool in `src/tools` /// /// This will build the specified tool with the specified `host` compiler in @@ -89,6 +93,10 @@ pub struct ToolBuild { impl Step for ToolBuild { type Output = PathBuf; + fn should_run(_builder: &Builder, _path: &Path) -> bool { + false + } + /// Build a tool in `src/tools` /// /// This will build the specified tool with the specified `host` compiler in