-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Enforce in bootstrap that check must have stage at least 1 #143048
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
f06e41e
to
aed5f23
Compare
CC @jieyouxu (one of many heaps of bootstrap fixup commits I have in store 😆) |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #141899) made this pull request unmergeable. Please resolve the merge conflicts. |
aed5f23
to
a36ee24
Compare
Cross-compilation checks are now doing too much work, I need to take a look at how we can reduce that, because |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #143254) made this pull request unmergeable. Please resolve the merge conflicts. |
a36ee24
to
22fb548
Compare
This PR modifies If appropriate, please update This PR modifies If appropriate, please update |
r? @jieyouxu |
|
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #143287) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
I like this a lot in general, it does feel much more self-consistent and coherent.
I left some questions/discussions for things that I wanted to double-check, but overall looks good!
self.stage.or(self | ||
.built_by | ||
.map(|compiler| if self.name == "std" { compiler.stage } else { compiler.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.
Discussion: this makes me feel a bit uneasy, but I guess the logic here is: anything that's not the standard library should be considered a non-library artifact, and should be considered a product of the stage n
(compiler, standard library) pair (and so gets numbered as the next stage)? I.e. reading back https://hackmd.io/QXj6LqntQTKPgm3uBuE-aA again, the core model is
stage corresponds to what gets built, not what is used to build it
(The following is me trying to make sure I understand this)
Let's call the (compiler, library) pair12
where the separation between stages is delineated by which
With the stage 0 redesign, we now have a nice straightforward "derivation chain" (
actually holds even for
However, for:
-
bootstrap tools
Tools that are unconditionally built by the stage 0$\mathbf{CLP}$ , i.e. always depends on$\mathbf{CLP}_{0}$ . Their stage numbering will be called$\mathrm{BootstrapTool}_{1}$ , at least in the short-term. -
host rustc tools
Tools that depend onrustc_private
and so on$\mathrm{compiler}_{\mathrm{stage}}$ . This means that they will be numbered as$\mathrm{HostRustcTool}_{\mathrm{stage} + 1}$ . -
std tools
Tools that depend on the whole$\mathbf{CLP}_{\mathrm{stage}}$ , i.e. both$\mathrm{compiler}_{\mathrm{stage}}$ , and$\mathrm{library}_{\mathrm{stage}}$ . Similiarly, this means that they will be numbered as$\mathrm{StdTool}_{\mathrm{stage} + 1}$ .
They then follow the general "what gets built" model (?).
Footnotes
builder.std(build_compiler, host); | ||
builder.std(build_compiler, target); | ||
builder.ensure(Std::new(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.
Question: wait, why is this different? For
rust/src/bootstrap/src/core/builder/mod.rs
Lines 1393 to 1409 in f51c987
if compiler.stage == 0 { | |
if target != compiler.host { | |
panic!( | |
r"It is not possible to build the standard library for `{target}` using the stage0 compiler. | |
You have to build a stage1 compiler for `{}` first, and then use it to build a standard library for `{target}`. | |
", | |
compiler.host | |
) | |
} | |
// We still need to link the prebuilt standard library into the ephemeral stage0 sysroot | |
self.ensure(StdLink::from_std(Std::new(compiler, target), compiler)); | |
} else { | |
// This step both compiles the std and links it into the compiler's sysroot. | |
// Yes, it's quite magical and side-effecty.. would be nice to refactor later. | |
self.ensure(Std::new(compiler, target)); | |
} |
At this point, wouldn't we have already rejected invoking ./x check
flow with
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.
Equivalent to what? :) I changed it just to this:
let build_compiler = builder.compiler(builder.top_stage, host);
builder.ensure(Std::new(build_compiler, target));
build_compiler
because I remembered that stdlib's proc macros and build scripts are always compiled using the stage0 libstd. We only need the host stdlib when compiling host code of other modes (yeah, I know..).
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.
Except! We actually need the host stdlib when checking the tool itself (not stdlib). Aaaaargh.
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.
Equivalent to what?
NGL, I don't know what I meant by this myself -- when I click at this comment, it's outdated against something, and I can't tell what it was...
@@ -48,7 +48,7 @@ ENV SCRIPT \ | |||
python3 ../x.py build src/tools/build-manifest && \ | |||
python3 ../x.py test --stage 0 src/tools/compiletest && \ | |||
python3 ../x.py check compiletest --set build.compiletest-use-stage0-libtest=true && \ | |||
python3 ../x.py check --stage 1 --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ | |||
python3 ../x.py check --stage 2 --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ |
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.
Suggestion: actually, can you add a comment for this specifically that we're exercising cross-compile here, so --stage 1
isn't sufficient?
…eyouxu Add bootstrap check snapshot tests Split off from rust-lang#143048, so that we get a baseline of how check behaved before we make changes to it. Note that the output of the check snapshot tests is suboptimal in many places, as we're missing information about stages and the build compiler. That will be changed in rust-lang#143048. r? `@jieyouxu`
Rollup merge of #143316 - Kobzol:bootstrap-check-tests, r=jieyouxu Add bootstrap check snapshot tests Split off from #143048, so that we get a baseline of how check behaved before we make changes to it. Note that the output of the check snapshot tests is suboptimal in many places, as we're missing information about stages and the build compiler. That will be changed in #143048. r? `@jieyouxu`
22fb548
to
fae5ba2
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
This PR is another step towards https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Proposal.20to.20cleanup.20stages.20and.20steps.20after.20the.20redesign/with/523586917, this time dealing with
x check
.It enforces the invariant that:
It creates a single function that prepares a proper build compiler for checking something, and also adds snapshot tests for various common check steps. Some obsolete code was also removed.
The default check stage also becomes 1, for all profiles. I tested manually that
x check std
withdownload-ci-rustc
still works and doesn't build rustc locally.Subsumes #139170.
r? @ghost