Skip to content

Commit e371348

Browse files
committed
Forbid documenting anything on stage 0
1 parent dc0bae1 commit e371348

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
@@ -788,6 +788,21 @@ mod snapshot {
788788
);
789789
}
790790

791+
#[test]
792+
fn build_compiler_lld_opt_in() {
793+
with_lld_opt_in_targets(vec![host_target()], || {
794+
let ctx = TestCtx::new();
795+
insta::assert_snapshot!(
796+
ctx.config("build")
797+
.path("compiler")
798+
.render_steps(), @r"
799+
[build] llvm <host>
800+
[build] rustc 0 <host> -> rustc 1 <host>
801+
[build] rustc 0 <host> -> LldWrapper 1 <host>
802+
");
803+
});
804+
}
805+
791806
#[test]
792807
fn build_library_no_explicit_stage() {
793808
let ctx = TestCtx::new();
@@ -1694,21 +1709,6 @@ mod snapshot {
16941709
");
16951710
}
16961711

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

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

17571750
#[test]
@@ -1789,16 +1782,10 @@ mod snapshot {
17891782
}
17901783

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

18041791
#[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)