-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Bad error message when a strong dep features's depedency is an unused optional dependency #14016
Comments
|
|
We discussed this in today's team meeting and lean towards |
fix(fix): Address problems with implicit -> explicit feature migration ### What does this PR try to resolve? Within the scope of `cargo fix` there are two problems - We wipe out existing feature activations if it has the same name as an optional dependency - The `Cargo.toml` isn't parseable because the unused optional dependency won't "exist" if just `dep_name/feature_name` is used Fixes #14010 ### How should we test and review this PR? As for the unused optional dependency not "existing" error, - #14015 is for improving the message for weak dep features - #14016 is for re-evaluating how we handle this for strong dep features Depending on what solution we go with for #14016, we might want to revisit the second migration within this PR. This is one reason I made the commit separate (in addition to just making it clearer whats happening as this gets into some finer details of features). ### Additional information
This doesn't revert the last commit of rust-lang#14018 so that it works properly on Editions 2021 and 2024. Fixes rust-lang#14016
This doesn't revert the last commit of rust-lang#14018 so that it works properly on Editions 2021 and 2024. Fixes rust-lang#14016
Problem
If nothing can activate an optional dependency, cargo acts as if the dependency doesn't exist which creates poor error messages.
Also, with how things are arranged, the unused optional dependency lint doesn't get reported which could at least reduce the burden on the error message.
Steps
Baseline
Cargo.toml
:Add the following to
Cargo.toml
:Possible Solution(s)
dep:serde
ifserde/derive
is usedserde/derive
syntax, removing it in a new edition (Transition out weak feature syntax in an edition #10556)Notes
This was split out of #14015 assuming we'll go with a different solution than it
Version
No response
The text was updated successfully, but these errors were encountered: