From b3d90afb56e4016bbef162578e4fb0e1fc77d9b6 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Wed, 6 Aug 2025 15:39:56 +0200 Subject: Forbid documenting anything on stage 0 --- src/bootstrap/src/core/builder/tests.rs | 51 ++++++++++++--------------------- src/bootstrap/src/core/config/config.rs | 8 ++++-- 2 files changed, 25 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 4c7766e58c1..3b1b3dd2edd 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -741,6 +741,21 @@ mod snapshot { ); } + #[test] + fn build_compiler_lld_opt_in() { + with_lld_opt_in_targets(vec![host_target()], || { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("build") + .path("compiler") + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> LldWrapper 1 + "); + }); + } + #[test] fn build_library_no_explicit_stage() { let ctx = TestCtx::new(); @@ -1747,21 +1762,6 @@ mod snapshot { "); } - #[test] - fn test_lld_opt_in() { - with_lld_opt_in_targets(vec![host_target()], || { - let ctx = TestCtx::new(); - insta::assert_snapshot!( - ctx.config("build") - .path("compiler") - .render_steps(), @r" - [build] llvm - [build] rustc 0 -> rustc 1 - [build] rustc 0 -> LldWrapper 1 - "); - }); - } - #[test] fn doc_library_no_std_target() { let ctx = TestCtx::new(); @@ -1794,17 +1794,10 @@ mod snapshot { } #[test] + #[should_panic] fn doc_compiler_stage_0() { let ctx = TestCtx::new(); - insta::assert_snapshot!( - ctx.config("doc") - .path("compiler") - .stage(0) - .render_steps(), @r" - [build] rustdoc 0 - [build] llvm - [doc] rustc 0 - "); + ctx.config("doc").path("compiler").stage(0).run(); } #[test] @@ -1842,16 +1835,10 @@ mod snapshot { } #[test] + #[should_panic] fn doc_compiletest_stage_0() { let ctx = TestCtx::new(); - insta::assert_snapshot!( - ctx.config("doc") - .path("src/tools/compiletest") - .stage(0) - .render_steps(), @r" - [build] rustdoc 0 - [doc] Compiletest - "); + ctx.config("doc").path("src/tools/compiletest").stage(0).run(); } #[test] diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index eb1ac8c637f..a6953bd4b25 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1349,11 +1349,15 @@ impl Config { // Now check that the selected stage makes sense, and if not, print a warning and end match (config.stage, &config.cmd) { (0, Subcommand::Build) => { - eprintln!("WARNING: cannot build anything on stage 0. Use at least stage 1."); + eprintln!("ERROR: cannot build anything on stage 0. Use at least stage 1."); exit!(1); } (0, Subcommand::Check { .. }) => { - eprintln!("WARNING: cannot check anything on stage 0. Use at least stage 1."); + eprintln!("ERROR: cannot check anything on stage 0. Use at least stage 1."); + exit!(1); + } + (0, Subcommand::Doc { .. }) => { + eprintln!("ERROR: cannot document anything on stage 0. Use at least stage 1."); exit!(1); } _ => {} -- cgit 1.4.1-3-g733a5