about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs10
-rw-r--r--src/bootstrap/src/core/builder/tests.rs57
2 files changed, 63 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index c71bd5e842e..83c0525d7c4 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1188,6 +1188,16 @@ macro_rules! tool_extended {
                     None $( .or(Some($add_features)) )?,
                 )
             }
+
+            fn metadata(&self) -> Option<StepMetadata> {
+                // FIXME: refactor extended tool steps to make the build_compiler explicit,
+                // it is offset by one now for rustc tools
+                Some(
+                    StepMetadata::build($tool_name, self.target)
+                        .built_by(self.compiler.with_stage(self.compiler.stage.saturating_sub(1)))
+                        .stage(self.compiler.stage)
+                )
+            }
         }
     }
 }
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index fa5786744c7..8adf93ea528 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -703,7 +703,7 @@ mod snapshot {
     }
 
     #[test]
-    fn build_compiler_no_stage() {
+    fn build_compiler_no_explicit_stage() {
         let ctx = TestCtx::new();
         insta::assert_snapshot!(
             ctx.config("build")
@@ -712,6 +712,14 @@ mod snapshot {
         [build] llvm <host>
         [build] rustc 0 <host> -> rustc 1 <host>
         ");
+
+        insta::assert_snapshot!(
+            ctx.config("build")
+                .path("rustc")
+                .render_steps(), @r"
+        [build] llvm <host>
+        [build] rustc 0 <host> -> rustc 1 <host>
+        ");
     }
 
     #[test]
@@ -750,7 +758,7 @@ mod snapshot {
     }
 
     #[test]
-    fn build_library_no_stage() {
+    fn build_library_no_explicit_stage() {
         let ctx = TestCtx::new();
         insta::assert_snapshot!(
             ctx.config("build")
@@ -800,7 +808,7 @@ mod snapshot {
     }
 
     #[test]
-    fn build_miri_no_stage() {
+    fn build_miri_no_explicit_stage() {
         let ctx = TestCtx::new();
         insta::assert_snapshot!(
             ctx.config("build")
@@ -808,6 +816,7 @@ mod snapshot {
                 .render_steps(), @r"
         [build] llvm <host>
         [build] rustc 0 <host> -> rustc 1 <host>
+        [build] rustc 0 <host> -> miri 1 <host>
         ");
     }
 
@@ -828,6 +837,7 @@ mod snapshot {
                 .render_steps(), @r"
         [build] llvm <host>
         [build] rustc 0 <host> -> rustc 1 <host>
+        [build] rustc 0 <host> -> miri 1 <host>
         ");
     }
 
@@ -843,11 +853,12 @@ mod snapshot {
         [build] rustc 0 <host> -> rustc 1 <host>
         [build] rustc 1 <host> -> std 1 <host>
         [build] rustc 1 <host> -> rustc 2 <host>
+        [build] rustc 1 <host> -> miri 2 <host>
         ");
     }
 
     #[test]
-    fn build_bootstrap_tool_no_stage() {
+    fn build_bootstrap_tool_no_explicit_stage() {
         let ctx = TestCtx::new();
         insta::assert_snapshot!(
             ctx.config("build")
@@ -901,6 +912,30 @@ mod snapshot {
         [build] rustc 1 <host> -> std 1 <host>
         ");
 
+        insta::assert_snapshot!(ctx.config("build")
+            .paths(&["std"])
+            .render_steps(), @r"
+        [build] llvm <host>
+        [build] rustc 0 <host> -> rustc 1 <host>
+        [build] rustc 1 <host> -> std 1 <host>
+        ");
+
+        insta::assert_snapshot!(ctx.config("build")
+            .paths(&["core"])
+            .render_steps(), @r"
+        [build] llvm <host>
+        [build] rustc 0 <host> -> rustc 1 <host>
+        [build] rustc 1 <host> -> std 1 <host>
+        ");
+
+        insta::assert_snapshot!(ctx.config("build")
+            .paths(&["alloc"])
+            .render_steps(), @r"
+        [build] llvm <host>
+        [build] rustc 0 <host> -> rustc 1 <host>
+        [build] rustc 1 <host> -> std 1 <host>
+        ");
+
         insta::assert_snapshot!(ctx.config("doc")
             .paths(&["library", "core"])
             .render_steps(), @r"
@@ -943,6 +978,8 @@ mod snapshot {
     #[test]
     fn dist_baseline() {
         let ctx = TestCtx::new();
+        // Note that stdlib is uplifted, that is why `[dist] rustc 1 <host> -> std <host>` is in
+        // the output.
         insta::assert_snapshot!(
             ctx
                 .config("dist")
@@ -997,6 +1034,12 @@ mod snapshot {
         [dist] rustc <host>
         [dist] rustc 1 <host> -> std <host>
         [dist] src <>
+        [build] rustc 0 <host> -> rustfmt 1 <host>
+        [build] rustc 0 <host> -> cargo-fmt 1 <host>
+        [build] rustc 0 <host> -> clippy-driver 1 <host>
+        [build] rustc 0 <host> -> cargo-clippy 1 <host>
+        [build] rustc 0 <host> -> miri 1 <host>
+        [build] rustc 0 <host> -> cargo-miri 1 <host>
         ");
     }
 
@@ -1181,6 +1224,12 @@ mod snapshot {
         [dist] rustc <target1>
         [dist] rustc 1 <host> -> std <target1>
         [dist] src <>
+        [build] rustc 0 <host> -> rustfmt 1 <target1>
+        [build] rustc 0 <host> -> cargo-fmt 1 <target1>
+        [build] rustc 0 <host> -> clippy-driver 1 <target1>
+        [build] rustc 0 <host> -> cargo-clippy 1 <target1>
+        [build] rustc 0 <host> -> miri 1 <target1>
+        [build] rustc 0 <host> -> cargo-miri 1 <target1>
         ");
     }