Skip to content

bootstrap: Handle dotted table keys when parsing bootstrap.toml#157335

Open
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:bootstrap/dotted_toml_keys
Open

bootstrap: Handle dotted table keys when parsing bootstrap.toml#157335
Dnreikronos wants to merge 2 commits into
rust-lang:mainfrom
Dnreikronos:bootstrap/dotted_toml_keys

Conversation

@Dnreikronos
Copy link
Copy Markdown
Contributor

@Dnreikronos Dnreikronos commented Jun 2, 2026

Fixes #156948

bootstrap.py has a small hand-rolled reader that pulls the stage0 cargo and rustc out of bootstrap.toml before the real TOML parser is built. It only understood [table] headers, so the dotted form that bootstrap.example.toml now uses (build.cargo = "...") was silently dropped, and the cargo/rustc lookup matched those keys in any table rather than only [build].

Teach the reader to strip an optional dotted prefix and treat it as the key's table, the same way configure.py does when it writes the file, and scope the cargo/rustc lookup to [build]. New tests cover the dotted form, equivalence with the section form, wrong-table rejection, and dotted target keys.

Disclosure: the code was written by AI (Claude); reviewed and tested by me.

bootstrap.py uses a small hand-written reader to find the stage0 cargo
and rustc in bootstrap.toml before the real TOML parser is available. It
only recognized `[table]` headers, so dotted keys such as
`build.cargo = "..."` -- the form now used in bootstrap.example.toml --
were silently ignored.

Match an optional dotted prefix on each key and treat that prefix as the
table the key belongs to, mirroring how configure.py strips the
`section.` part when writing the config.
program_config searched every table for the `cargo` and `rustc` keys, so
a key placed in an unrelated table was picked up while the real config
parser only reads them from `[build]`. Scope the lookup to the build
table so the Python and Rust sides agree.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 2, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 2, 2026

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bootstrap parsing of bootstrap.toml doesn't handle dotted table names in some cases

3 participants