Skip to content

Commit

Permalink
Make the default stage dependent on the subcommand
Browse files Browse the repository at this point in the history
 ### 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.
  • Loading branch information
jyn514 committed Jul 28, 2020
1 parent d34a1b0 commit 0192fa4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,22 @@ impl<'a> Builder<'a> {
}

fn new_internal(build: &Build, kind: Kind, paths: Vec<PathBuf>) -> Builder<'_> {
let top_stage = if let Some(explicit_stage) = build.config.stage {
explicit_stage
} else {
// See https://github.com/rust-lang/compiler-team/issues/326
match kind {
Kind::Doc => 0,
Kind::Build | Kind::Test => 1,
Kind::Bench | Kind::Dist | Kind::Install => 2,
// These are all bootstrap tools, which don't depend on the compiler.
// The stage we pass shouldn't matter, but use 0 just in case.
Kind::Check | Kind::Clippy | Kind::Fix | Kind::Run | Kind::Format => 0,
}
};
Builder {
build,
top_stage: build.config.stage.unwrap_or(2),
top_stage,
kind,
cache: Cache::new(),
stack: RefCell::new(Vec::new()),
Expand Down

0 comments on commit 0192fa4

Please sign in to comment.