Skip to content

Commit 0192fa4

Browse files
committed
Make the default stage dependent on the subcommand
### x.py build/test: stage 1 I've seen very few people who actually use full stage 2 builds on purpose. These compile rustc and libstd twice and don't give you much more information than a stage 1 build (except in rare cases like rust-lang#68692 (comment)). For new contributors, this makes the build process even more daunting than it already is. As long as CI is changed to use `--stage 2` I see no downside here. ### x.py bench/dist/install: stage 2 These commands have to do with a finished, optimized version of rustc. It seems very rare to want to use these with a stage 1 build. ### x.py doc: stage 0 Normally when you document things you're just fixing a typo. In this case there is no need to build the whole rust compiler, since the documentation will usually be the same when generated with the beta compiler or with stage 1. Note that for this release cycle only there will be a significant different between stage0 and stage1 docs: rust-lang#73101. However most of the time this will not be the case.
1 parent d34a1b0 commit 0192fa4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bootstrap/builder.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,22 @@ impl<'a> Builder<'a> {
527527
}
528528

529529
fn new_internal(build: &Build, kind: Kind, paths: Vec<PathBuf>) -> Builder<'_> {
530+
let top_stage = if let Some(explicit_stage) = build.config.stage {
531+
explicit_stage
532+
} else {
533+
// See https://github.com/rust-lang/compiler-team/issues/326
534+
match kind {
535+
Kind::Doc => 0,
536+
Kind::Build | Kind::Test => 1,
537+
Kind::Bench | Kind::Dist | Kind::Install => 2,
538+
// These are all bootstrap tools, which don't depend on the compiler.
539+
// The stage we pass shouldn't matter, but use 0 just in case.
540+
Kind::Check | Kind::Clippy | Kind::Fix | Kind::Run | Kind::Format => 0,
541+
}
542+
};
530543
Builder {
531544
build,
532-
top_stage: build.config.stage.unwrap_or(2),
545+
top_stage,
533546
kind,
534547
cache: Cache::new(),
535548
stack: RefCell::new(Vec::new()),

0 commit comments

Comments
 (0)