Skip to content

Commit e69c023

Browse files
committed
Apply review comments
1 parent b176ae2 commit e69c023

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,16 @@ macro_rules! tool_extended {
11881188
None $( .or(Some($add_features)) )?,
11891189
)
11901190
}
1191+
1192+
fn metadata(&self) -> Option<StepMetadata> {
1193+
// FIXME: refactor extended tool steps to make the build_compiler explicit,
1194+
// it is offset by one now for rustc tools
1195+
Some(
1196+
StepMetadata::build($tool_name, self.target)
1197+
.built_by(self.compiler.with_stage(self.compiler.stage.saturating_sub(1)))
1198+
.stage(self.compiler.stage)
1199+
)
1200+
}
11911201
}
11921202
}
11931203
}

src/bootstrap/src/core/builder/tests.rs

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ mod snapshot {
703703
}
704704

705705
#[test]
706-
fn build_compiler_no_stage() {
706+
fn build_compiler_no_explicit_stage() {
707707
let ctx = TestCtx::new();
708708
insta::assert_snapshot!(
709709
ctx.config("build")
@@ -712,6 +712,14 @@ mod snapshot {
712712
[build] llvm <host>
713713
[build] rustc 0 <host> -> rustc 1 <host>
714714
");
715+
716+
insta::assert_snapshot!(
717+
ctx.config("build")
718+
.path("rustc")
719+
.render_steps(), @r"
720+
[build] llvm <host>
721+
[build] rustc 0 <host> -> rustc 1 <host>
722+
");
715723
}
716724

717725
#[test]
@@ -750,7 +758,7 @@ mod snapshot {
750758
}
751759

752760
#[test]
753-
fn build_library_no_stage() {
761+
fn build_library_no_explicit_stage() {
754762
let ctx = TestCtx::new();
755763
insta::assert_snapshot!(
756764
ctx.config("build")
@@ -800,14 +808,15 @@ mod snapshot {
800808
}
801809

802810
#[test]
803-
fn build_miri_no_stage() {
811+
fn build_miri_no_explicit_stage() {
804812
let ctx = TestCtx::new();
805813
insta::assert_snapshot!(
806814
ctx.config("build")
807815
.path("miri")
808816
.render_steps(), @r"
809817
[build] llvm <host>
810818
[build] rustc 0 <host> -> rustc 1 <host>
819+
[build] rustc 0 <host> -> miri 1 <host>
811820
");
812821
}
813822

@@ -828,6 +837,7 @@ mod snapshot {
828837
.render_steps(), @r"
829838
[build] llvm <host>
830839
[build] rustc 0 <host> -> rustc 1 <host>
840+
[build] rustc 0 <host> -> miri 1 <host>
831841
");
832842
}
833843

@@ -843,11 +853,12 @@ mod snapshot {
843853
[build] rustc 0 <host> -> rustc 1 <host>
844854
[build] rustc 1 <host> -> std 1 <host>
845855
[build] rustc 1 <host> -> rustc 2 <host>
856+
[build] rustc 1 <host> -> miri 2 <host>
846857
");
847858
}
848859

849860
#[test]
850-
fn build_bootstrap_tool_no_stage() {
861+
fn build_bootstrap_tool_no_explicit_stage() {
851862
let ctx = TestCtx::new();
852863
insta::assert_snapshot!(
853864
ctx.config("build")
@@ -901,6 +912,30 @@ mod snapshot {
901912
[build] rustc 1 <host> -> std 1 <host>
902913
");
903914

915+
insta::assert_snapshot!(ctx.config("build")
916+
.paths(&["std"])
917+
.render_steps(), @r"
918+
[build] llvm <host>
919+
[build] rustc 0 <host> -> rustc 1 <host>
920+
[build] rustc 1 <host> -> std 1 <host>
921+
");
922+
923+
insta::assert_snapshot!(ctx.config("build")
924+
.paths(&["core"])
925+
.render_steps(), @r"
926+
[build] llvm <host>
927+
[build] rustc 0 <host> -> rustc 1 <host>
928+
[build] rustc 1 <host> -> std 1 <host>
929+
");
930+
931+
insta::assert_snapshot!(ctx.config("build")
932+
.paths(&["alloc"])
933+
.render_steps(), @r"
934+
[build] llvm <host>
935+
[build] rustc 0 <host> -> rustc 1 <host>
936+
[build] rustc 1 <host> -> std 1 <host>
937+
");
938+
904939
insta::assert_snapshot!(ctx.config("doc")
905940
.paths(&["library", "core"])
906941
.render_steps(), @r"
@@ -943,6 +978,8 @@ mod snapshot {
943978
#[test]
944979
fn dist_baseline() {
945980
let ctx = TestCtx::new();
981+
// Note that stdlib is uplifted, that is why `[dist] rustc 1 <host> -> std <host>` is in
982+
// the output.
946983
insta::assert_snapshot!(
947984
ctx
948985
.config("dist")
@@ -997,6 +1034,12 @@ mod snapshot {
9971034
[dist] rustc <host>
9981035
[dist] rustc 1 <host> -> std <host>
9991036
[dist] src <>
1037+
[build] rustc 0 <host> -> rustfmt 1 <host>
1038+
[build] rustc 0 <host> -> cargo-fmt 1 <host>
1039+
[build] rustc 0 <host> -> clippy-driver 1 <host>
1040+
[build] rustc 0 <host> -> cargo-clippy 1 <host>
1041+
[build] rustc 0 <host> -> miri 1 <host>
1042+
[build] rustc 0 <host> -> cargo-miri 1 <host>
10001043
");
10011044
}
10021045

@@ -1181,6 +1224,12 @@ mod snapshot {
11811224
[dist] rustc <target1>
11821225
[dist] rustc 1 <host> -> std <target1>
11831226
[dist] src <>
1227+
[build] rustc 0 <host> -> rustfmt 1 <target1>
1228+
[build] rustc 0 <host> -> cargo-fmt 1 <target1>
1229+
[build] rustc 0 <host> -> clippy-driver 1 <target1>
1230+
[build] rustc 0 <host> -> cargo-clippy 1 <target1>
1231+
[build] rustc 0 <host> -> miri 1 <target1>
1232+
[build] rustc 0 <host> -> cargo-miri 1 <target1>
11841233
");
11851234
}
11861235

0 commit comments

Comments
 (0)