Skip to content

cargo add: Show features that were explicitly enabled #10681

Open
@Aloso

Description

@Aloso

Problem

cargo add can be used to enable features of an existing dependency. In that situation, it's useful to see which features were enabled explicitly, i.e. are listed in the Cargo.toml file.

Proposed Solution

In the list of features, add the text (enabled explicitly) after explicitly enabled features:

cargo add once_cell -F parking_lot,unstable
    Updating crates.io index
      Adding once_cell v1.11.0 to dependencies.
             Features:
             + alloc
             + parking_lot (enabled explicitly)
             + parking_lot_core
             + race
             + std
             + unstable (enabled explicitly)
             - atomic-polyfill

Another possibility is to only show this with the --verbose/-v flag, but I think it's useful enough that it can be shown always.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-addS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions