From e69c0231f0752e180927070495e4b9b3bc9dd578 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Wed, 25 Jun 2025 07:58:05 +0200 Subject: Apply review comments --- src/bootstrap/src/core/build_steps/tool.rs | 10 ++++++ src/bootstrap/src/core/builder/tests.rs | 57 +++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 4 deletions(-) (limited to 'src') 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 { + // 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 [build] rustc 0 -> rustc 1 "); + + insta::assert_snapshot!( + ctx.config("build") + .path("rustc") + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + "); } #[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 [build] rustc 0 -> rustc 1 + [build] rustc 0 -> miri 1 "); } @@ -828,6 +837,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 + [build] rustc 0 -> miri 1 "); } @@ -843,11 +853,12 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 + [build] rustc 1 -> miri 2 "); } #[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 -> std 1 "); + insta::assert_snapshot!(ctx.config("build") + .paths(&["std"]) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + "); + + insta::assert_snapshot!(ctx.config("build") + .paths(&["core"]) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + "); + + insta::assert_snapshot!(ctx.config("build") + .paths(&["alloc"]) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + "); + 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 -> std ` is in + // the output. insta::assert_snapshot!( ctx .config("dist") @@ -997,6 +1034,12 @@ mod snapshot { [dist] rustc [dist] rustc 1 -> std [dist] src <> + [build] rustc 0 -> rustfmt 1 + [build] rustc 0 -> cargo-fmt 1 + [build] rustc 0 -> clippy-driver 1 + [build] rustc 0 -> cargo-clippy 1 + [build] rustc 0 -> miri 1 + [build] rustc 0 -> cargo-miri 1 "); } @@ -1181,6 +1224,12 @@ mod snapshot { [dist] rustc [dist] rustc 1 -> std [dist] src <> + [build] rustc 0 -> rustfmt 1 + [build] rustc 0 -> cargo-fmt 1 + [build] rustc 0 -> clippy-driver 1 + [build] rustc 0 -> cargo-clippy 1 + [build] rustc 0 -> miri 1 + [build] rustc 0 -> cargo-miri 1 "); } -- cgit 1.4.1-3-g733a5