Skip to content

Add bootstrap option to compile a tool with features #142379

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 2 commits into from
Jun 13, 2025

Conversation

Stypox
Copy link
Contributor

@Stypox Stypox commented Jun 11, 2025

Add an option to specify which features to build a tool with, e.g. it will be useful to build Miri with tracing enabled:

tool-config.miri.features = ["tracing"]

See this Zulip thread for the options considered. If the final decision will be different than what I wrote now, I will update the code as needed. The reason why the option is tool-config.miri.features instead of something like tool-features.miri is to possibly allow adding more tool-specific configurations in the future.

I didn't do any validation of the keys of the tool-config hashmap, since I saw that no validation is done on the tools hashset either.

I don't like much the fact that features can be chosen by various places of the codebase: Steps can have some fixed extra_features, prepare_tool_cargo will add features depending on some bootstrapping options, and the newly added option can also contribute features to tools. However I think it is out of scope of this PR to try to refactor all of that (if it even is refactorable), so I left a comment in the codebase explaining all of the sources of features I could find.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@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 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 11, 2025

This PR modifies src/bootstrap/src/core/config.

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

This PR modifies bootstrap.example.toml.

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

@jieyouxu
Copy link
Member

r? bootstrap

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thanks, this looks simple enough. With one caveat that I would rename it from tool-config to just tool. Basically anything in the bootstrap.toml file is a config option in one way or another, so it seems redundant.

@Stypox
Copy link
Contributor Author

Stypox commented Jun 12, 2025

@rustbot ready

Thanks for the review! I renamed to tool and added more docs

@Kobzol
Copy link
Contributor

Kobzol commented Jun 12, 2025

Thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 12, 2025

📌 Commit 17f69bf 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 12, 2025
bors added a commit that referenced this pull request Jun 13, 2025
Rollup of 10 pull requests

Successful merges:

 - #134847 (Implement asymmetrical precedence for closures and jumps)
 - #141491 (Delegate `<CStr as Debug>` to `ByteStr`)
 - #141770 (Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code)
 - #142069 (Introduce `-Zmacro-stats`)
 - #142158 (Tracking the old name of renamed unstable library features)
 - #142221 ([AIX] strip underlying xcoff object)
 - #142340 (miri: we can use apfloat's mul_add now)
 - #142379 (Add bootstrap option to compile a tool with features)
 - #142410 (intrinsics: rename min_align_of to align_of)
 - #142413 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4838c00 into rust-lang:master Jun 13, 2025
10 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 13, 2025
rust-timer added a commit that referenced this pull request Jun 13, 2025
Rollup merge of #142379 - Stypox:bootstrap-tool-config, r=Kobzol

Add bootstrap option to compile a tool with features

Add an option to specify which features to build a tool with, e.g. it will be useful to build Miri with tracing enabled:
```toml
tool-config.miri.features = ["tracing"]
```

See [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Passing.20--features.20to.20Miri.20build.20using.20.2E.2Fx.2Epy/with/523564773) for the options considered. If the final decision will be different than what I wrote now, I will update the code as needed. The reason why the option is `tool-config.miri.features` instead of something like `tool-features.miri` is to possibly allow adding more tool-specific configurations in the future.

I didn't do any validation of the keys of the `tool-config` hashmap, since I saw that no validation is done on the `tools` hashset either.

I don't like much the fact that features can be chosen by various places of the codebase: `Step`s can have some fixed `extra_features`, `prepare_tool_cargo` will add features depending on some bootstrapping options, and the newly added option can also contribute features to tools. However I think it is out of scope of this PR to try to refactor all of that (if it even is refactorable), so I left a comment in the codebase explaining all of the sources of features I could find.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 14, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#134847 (Implement asymmetrical precedence for closures and jumps)
 - rust-lang/rust#141491 (Delegate `<CStr as Debug>` to `ByteStr`)
 - rust-lang/rust#141770 (Merge `Cfg::render_long_html` and `Cfg::render_long_plain` methods common code)
 - rust-lang/rust#142069 (Introduce `-Zmacro-stats`)
 - rust-lang/rust#142158 (Tracking the old name of renamed unstable library features)
 - rust-lang/rust#142221 ([AIX] strip underlying xcoff object)
 - rust-lang/rust#142340 (miri: we can use apfloat's mul_add now)
 - rust-lang/rust#142379 (Add bootstrap option to compile a tool with features)
 - rust-lang/rust#142410 (intrinsics: rename min_align_of to align_of)
 - rust-lang/rust#142413 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

5 participants