bootstrap: Handle dotted table keys when parsing bootstrap.toml#157335
Open
Dnreikronos wants to merge 2 commits into
Open
bootstrap: Handle dotted table keys when parsing bootstrap.toml#157335Dnreikronos wants to merge 2 commits into
Dnreikronos wants to merge 2 commits into
Conversation
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.
Collaborator
|
r? @clubby789 rustbot has assigned @clubby789. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #156948
bootstrap.pyhas a small hand-rolled reader that pulls the stage0 cargo and rustc out ofbootstrap.tomlbefore the real TOML parser is built. It only understood[table]headers, so the dotted form thatbootstrap.example.tomlnow 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.pydoes 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.