Double-check `rustc` flag handling in bootstrap
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
JSON target specs were destabilized in https://github.com/rust-lang/rust/pull/150151 and https://github.com/rust-lang/rust/pull/151534. However, this broke trying to build rustc itself with a JSON target spec. This is because in a few places bootstrap is manually calling
rustcwithout the ability for the user to provide additional flags (primarily,-Zunstable-optionsto enable JSON targets).There's a few different ways to fix this. One would be to change these calls to
rustcto include flags provided by the user (such asRUSTFLAGS_NOT_BOOTSTRAP). Just to keep things simple, this PR proposes to just unconditionally pass-Zunstable-options.Another consideration here is how maintainable this is. A possible improvement here would be to have a function somewhere (BootstrapCommand, TargetSelection, free function) that would handle appropriately adding the
--targetflag. For example, that's what cargo does inCompileKind::add_target_arg.
-- https://github.com/rust-lang/rust/pull/152677
E-hard because this requires a lot of digging without mentoring bandwidth.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the bootstrap code paths that invoke rustc, then read the referenced PRs 150151, 151534, and 152677 to understand the JSON target regression. Trace how user-provided flags and --target are handled, and verify that building rustc with a JSON target spec works while the relevant bootstrap checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100