Skip to content

Commit b3d90af

Browse files
committed
Forbid documenting anything on stage 0
1 parent 915a766 commit b3d90af

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();
@@ -1747,21 +1762,6 @@ mod snapshot {
17471762
");
17481763
}
17491764

1750-
#[test]
1751-
fn test_lld_opt_in() {
1752-
with_lld_opt_in_targets(vec![host_target()], || {
1753-
let ctx = TestCtx::new();
1754-
insta::assert_snapshot!(
1755-
ctx.config("build")
1756-
.path("compiler")
1757-
.render_steps(), @r"
1758-
[build] llvm <host>
1759-
[build] rustc 0 <host> -> rustc 1 <host>
1760-
[build] rustc 0 <host> -> LldWrapper 1 <host>
1761-
");
1762-
});
1763-
}
1764-
17651765
#[test]
17661766
fn doc_library_no_std_target() {
17671767
let ctx = TestCtx::new();
@@ -1794,17 +1794,10 @@ mod snapshot {
17941794
}
17951795

17961796
#[test]
1797+
#[should_panic]
17971798
fn doc_compiler_stage_0() {
17981799
let ctx = TestCtx::new();
1799-
insta::assert_snapshot!(
1800-
ctx.config("doc")
1801-
.path("compiler")
1802-
.stage(0)
1803-
.render_steps(), @r"
1804-
[build] rustdoc 0 <host>
1805-
[build] llvm <host>
1806-
[doc] rustc 0 <host>
1807-
");
1800+
ctx.config("doc").path("compiler").stage(0).run();
18081801
}
18091802

18101803
#[test]
@@ -1842,16 +1835,10 @@ mod snapshot {
18421835
}
18431836

18441837
#[test]
1838+
#[should_panic]
18451839
fn doc_compiletest_stage_0() {
18461840
let ctx = TestCtx::new();
1847-
insta::assert_snapshot!(
1848-
ctx.config("doc")
1849-
.path("src/tools/compiletest")
1850-
.stage(0)
1851-
.render_steps(), @r"
1852-
[build] rustdoc 0 <host>
1853-
[doc] Compiletest <host>
1854-
");
1841+
ctx.config("doc").path("src/tools/compiletest").stage(0).run();
18551842
}
18561843

18571844
#[test]

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,11 +1349,15 @@ impl Config {
13491349
// Now check that the selected stage makes sense, and if not, print a warning and end
13501350
match (config.stage, &config.cmd) {
13511351
(0, Subcommand::Build) => {
1352-
eprintln!("WARNING: cannot build anything on stage 0. Use at least stage 1.");
1352+
eprintln!("ERROR: cannot build anything on stage 0. Use at least stage 1.");
13531353
exit!(1);
13541354
}
13551355
(0, Subcommand::Check { .. }) => {
1356-
eprintln!("WARNING: cannot check anything on stage 0. Use at least stage 1.");
1356+
eprintln!("ERROR: cannot check anything on stage 0. Use at least stage 1.");
1357+
exit!(1);
1358+
}
1359+
(0, Subcommand::Doc { .. }) => {
1360+
eprintln!("ERROR: cannot document anything on stage 0. Use at least stage 1.");
13571361
exit!(1);
13581362
}
13591363
_ => {}

0 commit comments

Comments
 (0)