Skip to content

Commit d8dca72

Browse files
committed
Forbid documenting anything on stage 0
1 parent 67d45f4 commit d8dca72

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

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

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,21 @@ mod snapshot {
741741
);
742742
}
743743

744+
#[test]
745+
fn build_compiler_lld_opt_in() {
746+
with_lld_opt_in_targets(vec![host_target()], || {
747+
let ctx = TestCtx::new();
748+
insta::assert_snapshot!(
749+
ctx.config("build")
750+
.path("compiler")
751+
.render_steps(), @r"
752+
[build] llvm <host>
753+
[build] rustc 0 <host> -> rustc 1 <host>
754+
[build] rustc 0 <host> -> LldWrapper 1 <host>
755+
");
756+
});
757+
}
758+
744759
#[test]
745760
fn build_library_no_explicit_stage() {
746761
let ctx = TestCtx::new();
@@ -1695,21 +1710,6 @@ mod snapshot {
16951710
");
16961711
}
16971712

1698-
#[test]
1699-
fn test_lld_opt_in() {
1700-
with_lld_opt_in_targets(vec![host_target()], || {
1701-
let ctx = TestCtx::new();
1702-
insta::assert_snapshot!(
1703-
ctx.config("build")
1704-
.path("compiler")
1705-
.render_steps(), @r"
1706-
[build] llvm <host>
1707-
[build] rustc 0 <host> -> rustc 1 <host>
1708-
[build] rustc 0 <host> -> LldWrapper 1 <host>
1709-
");
1710-
});
1711-
}
1712-
17131713
#[test]
17141714
fn doc_library_no_std_target() {
17151715
let ctx = TestCtx::new();
@@ -1742,17 +1742,10 @@ mod snapshot {
17421742
}
17431743

17441744
#[test]
1745+
#[should_panic]
17451746
fn doc_compiler_stage_0() {
17461747
let ctx = TestCtx::new();
1747-
insta::assert_snapshot!(
1748-
ctx.config("doc")
1749-
.path("compiler")
1750-
.stage(0)
1751-
.render_steps(), @r"
1752-
[build] rustdoc 0 <host>
1753-
[build] llvm <host>
1754-
[doc] rustc 0 <host>
1755-
");
1748+
ctx.config("doc").path("compiler").stage(0).run();
17561749
}
17571750

17581751
#[test]
@@ -1790,16 +1783,10 @@ mod snapshot {
17901783
}
17911784

17921785
#[test]
1786+
#[should_panic]
17931787
fn doc_compiletest_stage_0() {
17941788
let ctx = TestCtx::new();
1795-
insta::assert_snapshot!(
1796-
ctx.config("doc")
1797-
.path("src/tools/compiletest")
1798-
.stage(0)
1799-
.render_steps(), @r"
1800-
[build] rustdoc 0 <host>
1801-
[doc] Compiletest <host>
1802-
");
1789+
ctx.config("doc").path("src/tools/compiletest").stage(0).run();
18031790
}
18041791

18051792
#[test]

src/bootstrap/src/core/config/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,11 +1076,15 @@ impl Config {
10761076
// Now check that the selected stage makes sense, and if not, print a warning and end
10771077
match (config.stage, &config.cmd) {
10781078
(0, Subcommand::Build) => {
1079-
eprintln!("WARNING: cannot build anything on stage 0. Use at least stage 1.");
1079+
eprintln!("ERROR: cannot build anything on stage 0. Use at least stage 1.");
10801080
exit!(1);
10811081
}
10821082
(0, Subcommand::Check { .. }) => {
1083-
eprintln!("WARNING: cannot check anything on stage 0. Use at least stage 1.");
1083+
eprintln!("ERROR: cannot check anything on stage 0. Use at least stage 1.");
1084+
exit!(1);
1085+
}
1086+
(0, Subcommand::Doc { .. }) => {
1087+
eprintln!("ERROR: cannot document anything on stage 0. Use at least stage 1.");
10841088
exit!(1);
10851089
}
10861090
_ => {}

0 commit comments

Comments
 (0)