-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 silently ignores patch crates with a missing feature. #6444
Comments
Oh dear definitely sounds like a bug! I think we can probably turn this into a hard error |
I was curious about this, but there is a part of the |
The unused list is serialized into |
This is actually a bit more complicated than I first expected. It depends on whether or not a
However, if you don't have a lock file, it actually resolves to a previous version! Here's a sample project: This has a fake I'm not familiar with the resolver. From what I can tell, it doesn't really know about I'd like to propose just adding a warning whenever there are |
So if a new version of a crate on crates.io has a missing feature, it is silently ignored, right? |
I believe so. The resolver is a bit of a mystery to me. |
Oh thanks for digging in! I think this may also be conflating with #4678 which I've never really fully understood as an issue, but I know it's "lock file plus new patch sections equals weirdness". I actually think it's relatively correct behavior for the resolver to skip this dependency, it definitely has logic to simply filter out candidates that are missing features. I think the no-lockfile scenario is exhibiting this behavior, where it's actually somewhat correct that we're simply skipping the candidate provided by I think I agree with a warning here though! @ehuss the In terms of issuing warnings, I would personally prefer to only issue a warning when |
Yes, removing a feature is a breaking change. Before #5000 this would lead to Cargos resolver erroring loudly. But, it was mostly getting triggered by the resolver doing things out of order and trying really old versions of dependencies. So we switched to just ignoring the versions that don't have the required feature. Like how we just ignore versions that don't match the version requirement. But it is not quite "silently", like all filters the resolver uses if we can not find any valid resolution we report an error message explaining what was skipt and why. As @ehuss described you get a good error message if you force the resolver to use the @alexcrichton What is the legitimate use of an unused |
AFAIK there's no legitimate use of an unused |
Warn on unused patches. Adds a warning when a `[patch]` entry fails to match anything. I've hit this several times in the past, and it always takes me 5 minutes of confusion to figure out what's wrong. Fixes #6444
Steps
my_package
with a featuremy_funky_feature
:my_package
without the featuremy_funky_feature
:my_bin
, which depends onmy_package
, activates the featuremy_funky_feature
of it.my_package
which doesn't havemy_funky_feature
as patch formy_package
.my_package
without warning.Possible Solution(s)
Give a warning when a patch is ignored, because there is a missing feature.
Notes
Output of
cargo version
:The text was updated successfully, but these errors were encountered: