-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Set RUSTC_BOOTSTRAP=1 consistently #120096
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
I'm not sure we should do this. Users can bypass passing flags to this part of the build with RUSTFLAGS_NOT_BOOTSTRAP and similar. If we want to always pass this, I think we should also set -Zallow-features or otherwise make sure bootstrap doesn't encounter problems across stable versions. Distros rely on being able to build with a different version than our CI and this is effectively our only (implicit) way of providing that. |
|
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 think Mark's point was that whoever is setting RUSTFLAGS=-Zthreads=8 RUSTC_BOOTSTRAP=1
to get the failure in #120001 (comment) should instead be setting RUSTFLAGS_NOT_BOOTSTRAP=-Zthreads=8 RUSTC_BOOTSTRAP=1
.
That may not be adequate as a path forward because I'd guess they have that configured globally on their system, such as they put those flags in ~/.bashrc or similar, and want it to apply to all projects, not just rustc. So they do want RUSTFLAGS=-Zthreads=8
present, and there is no way using RUSTFLAGS_BOOTSTRAP=
to cancel that out from applying to bootstrap too.
But I agree with Mark's impression that the change currently in this PR (always setting RUSTC_BOOTSTRAP=1
) is not what I would want.
Unconditionally inserting -Zallow-features=
into RUSTFLAGS
would also not be good, because letting users opt in to -Zthreads=8
still seems valuable, and is the entire motivation for this PR anyway.
How about this?— For the purpose of validating that bootstrap can build with the most vanilla toolchain possible for the benefit of distros (i.e. we don't introduce unstable language features into bootstrap code over time), it should be sufficient to set -Zallow-features=
only if RUSTFLAGS and RUSTFLAGS_BOOTSTRAP are both absent or empty.
This way RUSTFLAGS=-Zthreads=8 RUSTC_BOOTSTRAP=1
works again, but we still get some validation that bootstrap works without features.
src/bootstrap/bootstrap.py
Outdated
if 'RUSTC_BOOTSTRAP' not in env: | ||
env['RUSTC_BOOTSTRAP'] = '1' | ||
|
||
# preserve existing RUSTFLAGS | ||
env.setdefault("RUSTFLAGS", "") |
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.
Something like this:
if 'RUSTC_BOOTSTRAP' not in env: | |
env['RUSTC_BOOTSTRAP'] = '1' | |
# preserve existing RUSTFLAGS | |
env.setdefault("RUSTFLAGS", "") | |
env["RUSTC_BOOTSTRAP"] = "1" | |
default_rustflags = "" if env.get("RUSTFLAGS_BOOTSTRAP", "") \ | |
else "-Zallow-features=" | |
env.setdefault("RUSTFLAGS", default_rustflags) |
I think that's a good suggestion, I like that approach. |
32f6f2a
to
26e96c8
Compare
Signed-off-by: onur-ozkan <[email protected]>
26e96c8
to
21b4fe2
Compare
Thanks! @bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#119582 (bootstrap: handle vendored sources when remapping crate paths) - rust-lang#119730 (docs: fix typos) - rust-lang#119828 (Improved collapse_debuginfo attribute, added command-line flag) - rust-lang#119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - rust-lang#120037 (Remove `next_root_ty_var`) - rust-lang#120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - rust-lang#120096 (Set RUSTC_BOOTSTRAP=1 consistently) - rust-lang#120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - rust-lang#120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#119582 (bootstrap: handle vendored sources when remapping crate paths) - rust-lang#119730 (docs: fix typos) - rust-lang#119828 (Improved collapse_debuginfo attribute, added command-line flag) - rust-lang#119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - rust-lang#120037 (Remove `next_root_ty_var`) - rust-lang#120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - rust-lang#120096 (Set RUSTC_BOOTSTRAP=1 consistently) - rust-lang#120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - rust-lang#120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120096 - onur-ozkan:rustc_bootstrap, r=dtolnay Set RUSTC_BOOTSTRAP=1 consistently Fixes https://internals.rust-lang.org/t/rust-compiler-with-parallel-build/20099 which is a regression from rust-lang#120001 cc `@dtolnay` `@petrochenkov`
Capture the rationale for `-Zallow-features=` in bootstrap.py Based on the discussion in rust-lang#120096.
Capture the rationale for `-Zallow-features=` in bootstrap.py Based on the discussion in rust-lang#120096.
Rollup merge of rust-lang#120167 - dtolnay:bootstrap, r=clubby789 Capture the rationale for `-Zallow-features=` in bootstrap.py Based on the discussion in rust-lang#120096.
Capture the rationale for `-Zallow-features=` in bootstrap.py Based on the discussion in rust-lang/rust#120096.
Capture the rationale for `-Zallow-features=` in bootstrap.py Based on the discussion in rust-lang/rust#120096.
Fixes https://internals.rust-lang.org/t/rust-compiler-with-parallel-build/20099 which is a regression from #120001
cc @dtolnay @petrochenkov