Skip to content

cargo install does not report needed features #11617

@epage

Description

@epage

Problem

Commands like cargo check will report needed features, like the following in clap:

$ cargo run --example git-derive
error: target `git-derive` in package `clap` requires the features: `derive`
Consider enabling them by passing, e.g., `--features="derive"`

If you install a specific bin, you get an error telling you how to install it

$ cargo install pulldown-cmark --no-default-features --bin pulldown-cmark
    Updating crates.io index
  Installing pulldown-cmark v0.9.2
error: failed to compile `pulldown-cmark v0.9.2`, intermediate artifacts can be found at `/tmp/cargo-installgpjZMz`

Caused by:
  target `pulldown-cmark` in package `pulldown-cmark` requires the features: `getopts`
  Consider enabling them by passing, e.g., `--features="getopts"`

However, if you do a general install (the more likely case), you get notified nothing is installed but no hint as to what features would change this

$ cargo install pulldown-cmark --no-default-features
    Updating crates.io index
  Installing pulldown-cmark v0.9.2
   Compiling version_check v0.9.4
   Compiling memchr v2.5.0
   Compiling pulldown-cmark v0.9.2
   Compiling bitflags v1.3.2
   Compiling unicase v2.6.0
    Finished release [optimized] target(s) in 1.86s
warning: none of the package's binaries are available for install using the selected features

Proposed Solution

Report to the user features to enable to install binaries

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-install

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions