Skip to content

feat(config): Add build.profile, install.profile - #17215

Open
epage wants to merge 3 commits into
rust-lang:masterfrom
epage:config-profile
Open

feat(config): Add build.profile, install.profile#17215
epage wants to merge 3 commits into
rust-lang:masterfrom
epage:config-profile

Conversation

@epage

@epage epage commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

View all comments

What does this PR try to resolve?

This adds build.profile to smooth out the transition for #15931 by allowing users to change to the debug profile by default.

This also adds install.profile

  • to further clarify that build.profile does not apply
  • to allow users to create a custom profile for their tools without affecting the rest of their development

How to test and review this PR?

This is part of #15931

  • dev profile changes are deferred for 1+ releases

How should test and bench be handled? We went with cargo test having build.profile override the default test so users will get consistent behavior between cargo build and cargo test. Alternatively, we could have told users to set profile.test.inherits = "debug". Changing the inheritance is even less obvious though it is likely to run into fewer issues if projects change the test profile.

@rustbot

rustbot commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
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: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, weihanglo

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-profiles Area: profiles Command-clean Command-install Command-test S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 14, 2026
@epage
epage marked this pull request as draft July 14, 2026 20:23
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 14, 2026
@epage
epage force-pushed the config-profile branch 4 times, most recently from 1127b1e to 2add9e9 Compare July 16, 2026 14:08
@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Jul 17, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Aug 7, 2026
### What does this PR try to resolve?

Key points:
- It inherits from `dev`
  - Conceptually, debugging is part of the development process
  - The hope is this will smooth out the transition for people
- `cargo install --debug` now uses `debug` instead of `dev`
- `debug` changes nothing from `dev` right now.
  `dev` will evolve in the future
(with `debug` overriding those values to leave it effectively unchanged)
  but that is deferred out to offer a transition period where `debug`
  can be used without but isn't required for debugging as people deal
  with multiple Rust versions. This also shrinks the change and
  decouples what the conversation around what the settings should be.
- `dev` still uses `target/debug`: this does not change any calculation
for the transition cost and any conflicts between the profiles should
mostly be in the artifact-dir (which are just hard links), especially
once the new build layout lands
- `--dev`/`--debug` flags are deferred out, needing more evaluation to
decide if they are worth it

See also
https://github.com/rust-lang/cargo-team/blob/main/meetings/sync-meeting/2026-07-14.md#splitting-dev-and-debug-profiles

### How to test and review this PR?

This is part of #15931
- `build.profile` will be a follow up (#17215)
- `dev` profile changes are deferred for 1+ releases
@rustbot

This comment has been minimized.

@epage
epage marked this pull request as ready for review August 10, 2026 17:06
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 10, 2026
@epage epage changed the title Config profile feat(config): Add build.profile, install.profile Aug 10, 2026
@rustbot

This comment has been minimized.

@epage
epage force-pushed the config-profile branch 2 times, most recently from 621897e to b6187f7 Compare August 18, 2026 03:29
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@weihanglo weihanglo Aug 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How should test and bench be handled? We went with cargo test having build.profile override the default test so users will get consistent behavior between cargo build and cargo test. Alternatively, we could have told users to set profile.test.inherits = "debug". Changing the inheritance is even less obvious though it is likely to run into fewer issues if projects change the test profile.

How do we communicate and document this? Do we need to decide before proceeding?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My assumption is that this will behave as people expect and the only documentation burden is on the fields. If there is something I'm overlooking, let me know!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Commented in other threads.

@rustbot

This comment has been minimized.

Comment thread doc/book/src/reference/config.md Outdated
Comment thread doc/book/src/reference/config.md Outdated
Comment on lines +551 to +554
* Default: `"dev"`
* Environment: `CARGO_BUILD_PROFILE`

The default [profile] to compile with.

@weihanglo weihanglo Aug 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this might need to be expanded. For example, explaing what scope it apply to, and the relationship with bench and test profiles. The tricky part is the default is not always dev for different scope. We should point that one.

(It's okay to be a bit vague, if we plan to change it in the future)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm cautious about getting into test and bench profiles because I expect most people don't know about them and could cause more confusion.

Unsure how to handle the install/bench nuance. “for development tasks"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm cautious about getting into test and bench profiles because I expect most people don't know about them and could cause more confusion.

I got a different impression that because people tend to tweak profile.test profile for either a faster test execution time, or just want to coerce that to match release profile in order to reuse cache.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For bench, yeah people just don't care about it, as keeping the same as release is pretty reasonable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've at least changed the default. Still a bit unsure what else to say here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Commented in other threads.

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@weihanglo weihanglo added the T-cargo Team: Cargo label Aug 31, 2026
@weihanglo

Copy link
Copy Markdown
Member

Before kicking off the FCP, would you mind sharing the complete transition plan with this feature?

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@epage

epage commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Before kicking off the FCP, would you mind sharing the complete transition plan with this feature?

Not too sure what more you are looking for. The PR description talks about this easing the transition to the split dev/debug profiles by allowing people to choose to switch to debug exclusively to get the old behavior back.

@weihanglo

Copy link
Copy Markdown
Member

Before kicking off the FCP, would you mind sharing the complete transition plan with this feature?

Not too sure what more you are looking for. The PR description talks about this easing the transition to the split dev/debug profiles by allowing people to choose to switch to debug exclusively to get the old behavior back.

I actually forgot what I was looking for.


@rfcbot fcp merge

This insta-stabilizes two new configs: build.profile and install.profile. See PR description and the proposed doc update for details.

@rust-rfcbot

rust-rfcbot commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-profiles Area: profiles Command-clean Command-install Command-test disposition-merge FCP with intent to merge proposed-final-comment-period An FCP proposal has started, but not yet signed off. S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-cargo Team: Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants