feat(config): Add build.profile, install.profile - #17215
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
1127b1e to
2add9e9
Compare
This comment has been minimized.
This comment has been minimized.
### 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
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
621897e to
b6187f7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
How should
testandbenchbe handled? We went withcargo testhavingbuild.profileoverride the defaulttestso users will get consistent behavior betweencargo buildandcargo test. Alternatively, we could have told users to setprofile.test.inherits = "debug". Changing the inheritance is even less obvious though it is likely to run into fewer issues if projects change thetestprofile.
How do we communicate and document this? Do we need to decide before proceeding?
There was a problem hiding this comment.
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!
|
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. |
| * Default: `"release"` | ||
| * Environment: `CARGO_INSTALL_PROFILE` | ||
|
|
||
| The default [profile] to compile with. |
There was a problem hiding this comment.
It is not clear what it is associated with. I don't think install.profile is self-explained enough. Maybe something like
| The default [profile] to compile with. | |
| The default [profile] to compile with when using `cargo install`. |
| * Default: `"dev"` | ||
| * Environment: `CARGO_BUILD_PROFILE` | ||
|
|
||
| The default [profile] to compile with. |
There was a problem hiding this comment.
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)
What does this PR try to resolve?
This adds
build.profileto smooth out the transition for #15931 by allowing users to change to thedebugprofile by default.This adds
install.profilebuild.profiledoes not applyHow to test and review this PR?
This is part of #15931
devprofile changes are deferred for 1+ releasesHow should
testandbenchbe handled? We went withcargo testhavingbuild.profileoverride the defaulttestso users will get consistent behavior betweencargo buildandcargo test. Alternatively, we could have told users to setprofile.test.inherits = "debug". Changing the inheritance is even less obvious though it is likely to run into fewer issues if projects change thetestprofile.