Skip to content

Tracking issue for custom-named-profile (RFC 2678) #6988

Closed
@da-x

Description

@da-x

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 and bench outputs in target/debug and target/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 of bench and test to be release and debug to keep the current behavior. This may be sufficient until a "global binary cache" feature is implemented, or a per-workspace target/.cache (related discussion). Decided to not expose dir-name and just leave it as a special-case for the built-in profiles.
  • Should the PROFILE environment variable in build scripts be deprecated? Currently it only sets DEBUG or RELEASE, which isn't really useful. Should guide users to use DEBUG and OPT_LEVEL instead. Decided to deprecate PROFILE (via documentation).
  • Update these commands to support custom named profiles:
  • 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?)?
  • 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 from dev is a change in behavior, will that be a problem? Decided it shouldn't be a major issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-profilesArea: profilesC-tracking-issueCategory: A tracking issue for something unstable.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions