Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo add "package@*" evaluates features of wrong version #14832

Closed
ctz opened this issue Nov 16, 2024 · 2 comments
Closed

cargo add "package@*" evaluates features of wrong version #14832

ctz opened this issue Nov 16, 2024 · 2 comments
Labels
C-bug Category: bug Command-add S-triage Status: This issue is waiting on initial triage.

Comments

@ctz
Copy link
Contributor

ctz commented Nov 16, 2024

Problem

My goal is to enable a crate feature on an existing dependency, via the CLI.

If I run:

$ cargo add --dev --features bindgen "aws-lc-sys@*" --package rustls --verbose

(I already have aws-lc-sys as a dependency, I want to enable this feature without introducing a different version.)

I get:

    Updating crates.io index
      Adding aws-lc-sys * to dev-dependencies
error: unrecognized feature for crate aws-lc-sys: bindgen
disabled features:
    asan

I think this is because cargo add resolves a different version to that which would be selected if I just wrote aws-lc-sys = { version = "*", features = ["bindgen"] } into the Cargo.toml myself. That means that the features it prints are the wrong ones.

Steps

  1. git clone --branch v/0.23.17 https://github.com/rustls/rustls.git
  2. cd rustls
  3. cargo add --dev --features bindgen "aws-lc-sys@*" --package rustls --verbose

Possible Solution(s)

I think cargo add should reuse normal version resolution when asked for version "*"?

Notes

No response

Version

cargo 1.81.0 (2dbb1af80 2024-08-20)
release: 1.81.0
commit-hash: 2dbb1af80a2914475ba76827a312e29cedfa6b2f
commit-date: 2024-08-20
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.8.0-DEV (sys:0.4.73+curl-8.8.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 24.4.0 (noble) [64-bit]
@ctz ctz added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Nov 16, 2024
@epage
Copy link
Contributor

epage commented Nov 16, 2024

This looks like a duplicate of #14648. See that issue for context on what is going on.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2024
@ctz
Copy link
Contributor Author

ctz commented Nov 16, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-add S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants