-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Enforce in bootstrap that doc must have stage at least 1 #145011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
☔ The latest upstream changes (presumably #145020) made this pull request unmergeable. Please resolve the merge conflicts. |
As they were previously.
This PR modifies If appropriate, please update |
Rebased over the two merged PRs, should be ready now. @rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! The changes look good in the general sense that it does feel more self-consistent. I do have some questions though that occurred to me when looking at the changes.
@@ -1076,11 +1076,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."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: lol I didn't notice this
fn prepare_doc_compiler(builder: &Builder<'_>, target: TargetSelection, stage: u32) -> Compiler { | ||
let build_compiler = builder.compiler(stage - 1, builder.host_target); | ||
builder.std(build_compiler, target); | ||
build_compiler | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: maybe overkill, should this assert that the passed in stage is at least one?
#[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 <host> | ||
[build] llvm <host> | ||
[doc] rustc 0 <host> | ||
"); | ||
ctx.config("doc").path("compiler").stage(0).run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: hm, would we regress any actual use cases of documenting the stage 0 compiler?
/// It is always done using a stage 1+ compiler, because it references in-tree compiler/stdlib | ||
/// concepts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "It is always done" -> "It must always be done" (stronger emphasis)?
// Bump the stage to 2, because the reference requires an in-tree compiler. | ||
// At the same time, since this step is enabled by default, we don't want `x doc` to fail | ||
// in stage 1. | ||
// FIXME: create a shared method on builder for auto-bumping, and print some warning when | ||
// it happens. | ||
let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 2 { | ||
run.builder.top_stage | ||
} else { | ||
2 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: hmm, auto-bumping stages always feel a bit sad (because it can be quite surprising to the user), but I suppose this makes sense. Good call on the warning when it will happen.
// Build rustc docs so that we generate relative links. | ||
run.builder.ensure(Rustc::from_build_compiler(run.builder, compilers.build_compiler(), target)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: hah, this is not super obvious...
[build] rustdoc 0 <host> | ||
[doc] rustc 0 <host> -> Compiletest 1 <host> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: hm, to clarify, the staging in ./x doc $thing --stage=N
corresponds to "what gets built"
[doc] rustc 2 <host> -> std 2 <host> crates=[] | ||
[doc] rustc 2 <host> -> std 2 <target1> crates=[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: hm, this is always a bit funny, when we run a std doc step with
crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind]
but then again later with
crates=[]
then I think we rely on the fact that they can unify to not have this invalidate the previous build cache (?)
[doc] book (book) <host> | ||
[doc] book/first-edition (book) <host> | ||
[doc] book/second-edition (book) <host> | ||
[doc] book/2018-edition (book) <host> | ||
[build] rustdoc 1 <host> | ||
[doc] rustc 1 <host> -> standalone 2 <host> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: wait, are we building less than we should be? I.e. there are two hosts,
Hm... or taking a step back, what does the "hosts" config actually mean in bootstrap?
@rustbot author |
Following with the bootstrap cleanups, this time around
doc
steps. Should be pretty straightforward, because the supporting infrastructure was already there.The only thing I found a bit fishy is using
Mode::ToolBootstrap
as a "catch-all" mode for non-rustc-private steps intool_doc!
, but I don't think that we need to distinguish the tools in some special way when documenting them, apart from supportingrustc_private
.Before,
x doc
more or less defaulted to what we call stage 2 now. Now it is properly stage 1, so e.g.x doc compiler
documents the compiler using the stage0/beta rust(do)c.r? @jieyouxu