Closed
Description
RFC: rust-lang/rfcs#2678
Implementation: #6989
Docs: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#custom-named-profiles
Summary
Adds user-defined profile names.
Unresolved questions:
- Bikeshedding the
inherits
keyword name. Decided it should be fine. - Should we keep user profiles under a Toml namespace of their own? Decided to use a flat namespace for simplicity.
For example:
[profile.custom.release-lto]
inherits = "release"
lto = true
* If so, should the `inherits` keyword be able to refer to custom and pre-defined profiles differently?
- Profile names would collide with rustc target names under
target/
. Should
the output directory be also under a different namespace, e.g.
target/custom/release-lto
? Decided to use a flat namespace. - Do we really need pre-defined profiles for
test
,bench
, or can we make them obsolete? Will keep them for now. - Is it worthwhile keeping
test
andbench
outputs intarget/debug
andtarget/release
? Doing so would save compilation time and space. Deferred for future target layout reorg.- If so, is the
dir-name
keyword necessary? Alternatively, we can hand-code the output directory ofbench
andtest
to berelease
anddebug
to keep the current behavior. This may be sufficient until a "global binary cache" feature is implemented, or a per-workspacetarget/.cache
(related discussion). Decided to not exposedir-name
and just leave it as a special-case for the built-in profiles.
- If so, is the
- Should the
PROFILE
environment variable in build scripts be deprecated? Currently it only setsDEBUG
orRELEASE
, which isn't really useful. Should guide users to useDEBUG
andOPT_LEVEL
instead. Decided to deprecate PROFILE (via documentation). - Update these commands to support custom named profiles:
-
check
-
rustc
-
fix
- Any others? Fixed Named profile updates #9685
-
- What is the interaction with the (future) build profile and unified build directories? Reserved several names in Named profile updates #9685 for adding in the future.
- Consider making an uber profile above dev/release where build settings could be set (
root
?)?
- Consider making an uber profile above dev/release where build settings could be set (
- How should automatic target-based profile selection work? For example, today,
cargo build --all-targets
automatically uses the "test" profile for tests. IIRC, named-profiles changes that behavior. I lean towards the original RFC, where it retains the original behavior, unless--profile
is specified, but I am uncertain. Decided to go with a single profile per cargo invocation. -
test
inheriting fromdev
is a change in behavior, will that be a problem? Decided it shouldn't be a major issue.
Metadata
Metadata
Assignees
Type
Projects
Status
Done