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

Confusing error message when feature depends on an optional dependency and its feature #12111

Closed
divergentdave opened this issue May 8, 2023 · 2 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@divergentdave
Copy link

Problem

I wrote a feature specification that depended on both an optional dependency, and a feature of that optional dependency, and I got a confusing error message. Deleting the dep:... item from the list fixed the issue, and got things working the way I wanted, but this fix wasn't apparent from the error message. Here's a minimal reproducing Cargo.toml file, and the resulting error message.

[package]
name = "cargo-feature-error-message"
version = "0.1.0"
edition = "2021"

[dependencies]
keccak = { version = "0.1.4", optional = true }

[features]
my_feature = ["dep:keccak", "keccak/asm"]
error: Package `cargo-feature-error-message v0.1.0 (/home/david/scratch/cargo-feature-error-message)` does not have feature `keccak`. It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

Does keccak/asm implicitly enable a keccak feature, and is that why I'm getting this message, or is this just an error handling edge case?

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.69.0 (6e9a83356 2023-04-12)
release: 1.69.0
commit-hash: 6e9a83356b70586d4b77613a6b33f9ea067b9cdf
commit-date: 2023-04-12
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Ubuntu 22.04 (jammy) [64-bit]
@divergentdave divergentdave added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels May 8, 2023
@Eh2406
Copy link
Contributor

Eh2406 commented May 11, 2023

Does keccak/asm implicitly enable a keccak feature?

Yes, it does.

@ehuss
Copy link
Contributor

ehuss commented May 11, 2023

Thanks fore the report! This is a duplicate of #10788, so closing in favor of that. This is supposed to work, it was just an oversight.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants