rust-lang / rust-lang/rust

Double-check `rustc` flag handling in bootstrap

Open
#152,709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-target-specs A-targets C-cleanup E-hard T-bootstrap
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 rustc without the ability for the user to provide additional flags (primarily, -Zunstable-options to enable JSON targets).

There's a few different ways to fix this. One would be to change these calls to rustc to include flags provided by the user (such as RUSTFLAGS_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 --target flag. For example, that's what cargo does in CompileKind::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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.