fix from_over_into false positive with conflicting blanket From impl#16881
Merged
Alexendoo merged 3 commits intorust-lang:masterfrom Apr 26, 2026
Merged
fix from_over_into false positive with conflicting blanket From impl#16881Alexendoo merged 3 commits intorust-lang:masterfrom
from_over_into false positive with conflicting blanket From impl#16881Alexendoo merged 3 commits intorust-lang:masterfrom
Conversation
Collaborator
|
r? @dswij rustbot has assigned @dswij. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Alexendoo
reviewed
Apr 25, 2026
| let Some(from_def_id) = cx.tcx.get_diagnostic_item(sym::From) else { | ||
| return false; | ||
| }; | ||
| cx.tcx.all_impls(from_def_id).any(|impl_id| { |
Member
There was a problem hiding this comment.
This can use cx.tcx.non_blanket_impls_for_ty to avoid iterating over all From impls
Despite the name impl From<T> for Foo is stored in TraitImpls::non_blanket_impls, this disagrees with the glossary but I'm not sure which one is correct
Contributor
Author
There was a problem hiding this comment.
thanks for pointing it out, also dropped the self_ty == check since non_blanket_impls_for_ty already handles that
Alexendoo
approved these changes
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #16823
This is my first contribution to Clippy, happy to make changes if the approach isn't quite right
changelog: [
from_over_into]: don't lint when a blanketFromimpl would cause a coherence conflict