Skip to content

bootstrap.example.toml: use less contextual format #142636

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

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

lolbinarycat
Copy link
Contributor

prefixing each key with its section means you don't need to scroll up 4 pages to see which section
a particular key is from.

target specific options were kept in old format since the exact section name depends on the target, so those options must now be moved to the bottom of the file.

inspired by zulip discussion

r? @workingjubilee

prefixing each key with its section means you don't
need to scroll up 4 pages to see which section
a particular key is from.

target specific options were kept in old format
since the exact section name depends on the target,
so those options must now be moved to the bottom of
the file.
@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 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 17, 2025

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 17, 2025

Note that the Python part of bootstrap parses this file, so it will probably require some changes in it 🥶

Comment on lines +166 to +181
#llvm.clang = false

# Whether to enable llvm compilation warnings.
#enable-warnings = false
#llvm.enable-warnings = false

# Custom CMake defines to set when building LLVM.
#build-config = {}
#llvm.build-config = {}

# =============================================================================
# Tweaking how GCC is compiled
# =============================================================================
[gcc]
# Download GCC from CI instead of building it locally.
# Note that this will attempt to download GCC even if there are local
# modifications to the `src/gcc` submodule.
# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
#download-ci-gcc = false
#gcc.download-ci-gcc = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget. If we have a sequence like this:

llvm.clang = false
gcc.download-ci-gcc = false
llvm.enable-warnings = false

does that still parse correctly as toml?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, that was the one thing I was wondering about.

Copy link
Member

@workingjubilee workingjubilee Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a point during the TOML spec discussions leading up to 1.0 where some of us argued we should not allow this.

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the bootstrap-example-unsection branch from fb25417 to a0158b8 Compare June 17, 2025 20:30
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the bootstrap-example-unsection branch from a0158b8 to 59ef0b2 Compare June 17, 2025 20:36
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the bootstrap-example-unsection branch from 59ef0b2 to 851fd58 Compare June 17, 2025 20:44
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the bootstrap-example-unsection branch from 851fd58 to 1d22c66 Compare June 17, 2025 20:58
@lolbinarycat
Copy link
Contributor Author

configure.py has been updated to handle the new format. this was done by adjusting the parsing code so that it emulates the old format. i might've done a more proper refactor if it wasn't for the fact that I believe there are plans to get rid of this python logic entirely.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 20, 2025

Well, these plans have existed for a long time 😆

Seems like the new logic in Python skips the documentation of the first field in each section. I printed the sections:

(after)
  'install': [
    '[install]',
    '#prefix = "/usr/local"',

(before)
  'install': [
    '[install]',
    '',
    '# Where to install the generated toolchain. Must be an absolute path.',
    '#prefix = "/usr/local"',

The non-first keys seem to have documentation properly.

The parsing of top-level keys also returns different results, but I'm not sure if it was correct before. It included the comment above change-id.

@lolbinarycat
Copy link
Contributor Author

@Kobzol fixed parsing and added a comment about how toml works.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 20, 2025

(seems like you didn't push? :) )

@lolbinarycat lolbinarycat force-pushed the bootstrap-example-unsection branch from 1d22c66 to bedc0ea Compare June 20, 2025 18:09
@lolbinarycat
Copy link
Contributor Author

@Kobzol whoops, sorry about that

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 23, 2025

There are some differences in ./configure output w.r.t. master:

(master)
# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
profile = 'dist'

[llvm]

[gcc]
# Download GCC from CI instead of building it locally.
# Note that this will attempt to download GCC even if there are local
# modifications to the `src/gcc` submodule.
# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
#download-ci-gcc = false

[build]

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = []

[install]

[rust]

[target.x86_64-unknown-linux-gnu]

[dist]

(this PR)
# Use different pre-set defaults than the global defaults.
#
# See `src/bootstrap/defaults` for more information.
# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
profile = 'dist'

[llvm]

[gcc]

[build]

# Arguments passed to the `./configure` script, used during distcheck. You
# probably won't fill this in but rather it's filled in by the `./configure`
# script. Useful for debugging.
configure-args = []

[install]

[rust]

[dist]

[target.x86_64-unknown-linux-gnu]

Not sure which one is more "correct" though 🤔

@workingjubilee
Copy link
Member

I am willing to assert the new one is more correct because the old one has a commented-out entry.

@Kobzol
Copy link
Contributor

Kobzol commented Jun 23, 2025

Agreed, I was just curious what happened there. Anyway, it looks better than before.

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 23, 2025

📌 Commit a759f05 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 23, 2025
jdonszelmann added a commit to jdonszelmann/rust that referenced this pull request Jun 23, 2025
…ection, r=Kobzol

bootstrap.example.toml: use less contextual format

prefixing each key with its section means you don't need to scroll up 4 pages to see which section
a particular key is from.

target specific options were kept in old format since the exact section name depends on the target, so those options must now be moved to the bottom of the file.

[inspired by zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/consider.20rewriting.20bootstrap.2Eexample.2Etoml.20to.20use.20section.2Ekey/with/521734873)

r? `@workingjubilee`
bors added a commit that referenced this pull request Jun 23, 2025
Rollup of 5 pull requests

Successful merges:

 - #142493 (rework `#[naked]` attribute parser)
 - #142636 (bootstrap.example.toml: use less contextual format)
 - #142822 (Make `PartialEq` a `const_trait`)
 - #142892 (Fix ICE on debug builds where lints are delayed on the crate root)
 - #142904 (notify me when rdg is touched)

Failed merges:

 - #142827 (Move error code explanation removal check into tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7df08be into rust-lang:master Jun 23, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 23, 2025
rust-timer added a commit that referenced this pull request Jun 23, 2025
Rollup merge of #142636 - lolbinarycat:bootstrap-example-unsection, r=Kobzol

bootstrap.example.toml: use less contextual format

prefixing each key with its section means you don't need to scroll up 4 pages to see which section
a particular key is from.

target specific options were kept in old format since the exact section name depends on the target, so those options must now be moved to the bottom of the file.

[inspired by zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/consider.20rewriting.20bootstrap.2Eexample.2Etoml.20to.20use.20section.2Ekey/with/521734873)

r? ``@workingjubilee``
@cuviper cuviper modified the milestones: 1.89.0, 1.90.0 Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

7 participants