Skip to content

cargo install cargo-edit --no-default-features fails to compile #947

@zacknewman

Description

@zacknewman
[zack@laptop ~]$ cargo install cargo-edit --no-default-features
⋮
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `clap`
  --> /home/zack/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-edit-0.13.7/src/errors.rs:55:11
   |
55 | impl From<clap::Error> for CliError {
   |           ^^^^ use of unresolved module or unlinked crate `clap`
   |
   = help: if you wanted to use a crate named `clap`, use `cargo add clap` to add it to your `Cargo.toml`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `clap`
  --> /home/zack/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-edit-0.13.7/src/errors.rs:56:18
   |
56 |     fn from(err: clap::Error) -> CliError {
   |                  ^^^^ use of unresolved module or unlinked crate `clap`
   |
   = help: if you wanted to use a crate named `clap`, use `cargo add clap` to add it to your `Cargo.toml`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `cargo-edit` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-edit v0.13.7`, intermediate artifacts can be found at `/tmp/cargo-installgFtuDU`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Machine info:

[zack@laptop ~]$ uname -a
Linux laptop 6.16.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 Aug 2025 15:32:49 +0000 x86_64 GNU/Linux
[zack@laptop ~]$ cargo -V
cargo 1.89.0 (c24e10642 2025-06-23)

If one must enable certain features, ideally compile_error would be used informing a user the minimum set of features that must be enabled; otherwise any use of clap should be gated behind a cfg attribute based on the set of features that enable it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions