about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2023-05-25 13:52:30 -0500
committerjyn <github@jyn.dev>2023-05-29 13:26:44 -0500
commit3e765a7f719951a9c1b69a13487e9f817e5a03b1 (patch)
treef5c5de30abeae41676fb964679785844810b6349 /src/bootstrap
parent58e18ddf86e67a1210a60ab4a0ad5e1adfbbc819 (diff)
downloadrust-3e765a7f719951a9c1b69a13487e9f817e5a03b1.tar.gz
rust-3e765a7f719951a9c1b69a13487e9f817e5a03b1.zip
Switch Steps from crates to crate_or_deps where possible
and document why the single remaining place can't switch
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs2
-rw-r--r--src/bootstrap/check.rs6
-rw-r--r--src/bootstrap/compile.rs2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index b16e34c0b93..cf9ae4f0818 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -442,6 +442,8 @@ impl<'a> ShouldRun<'a> {
     /// Indicates it should run if the command-line selects any of the given crates.
     ///
     /// `make_run` will be called a single time with all matching command-line paths.
+    ///
+    /// Prefer [`ShouldRun::crate_or_deps`] to this function where possible.
     pub(crate) fn crates(mut self, crates: Vec<&Crate>) -> Self {
         for krate in crates {
             let path = krate.local_path(self.builder);
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 09835516f7b..f5a93854bf2 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -85,8 +85,7 @@ impl Step for Std {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        let crates = run.builder.in_tree_crates("sysroot", None);
-        run.crates(crates).path("library")
+        run.crate_or_deps("sysroot").path("library")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -215,8 +214,7 @@ impl Step for Rustc {
     const DEFAULT: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        let crates = run.builder.in_tree_crates("rustc-main", None);
-        run.crates(crates).path("compiler")
+        run.crate_or_deps("rustc-main").path("compiler")
     }
 
     fn make_run(run: RunConfig<'_>) {
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 7b9c4c0f3b3..a7ebd018a87 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -620,6 +620,8 @@ impl Step for Rustc {
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let mut crates = run.builder.in_tree_crates("rustc-main", None);
         for (i, krate) in crates.iter().enumerate() {
+            // We can't allow `build rustc` as an alias for this Step, because that's reserved by `Assemble`.
+            // Ideally Assemble would use `build compiler` instead, but that seems too confusing to be worth the breaking change.
             if krate.name == "rustc-main" {
                 crates.swap_remove(i);
                 break;