-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Provide structured suggestions when finding structs when expecting a trait #77087
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
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
403a675
to
b10dae8
Compare
}; | ||
if !(matches!( | ||
partial_res.base_res(), | ||
hir::def::Res::Def(hir::def::DefKind::AssocTy, _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? This suggestion would also make sense for <&T as Trait>::Assoc: String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might have meant to point at the next matches
check, as this one just verifies that we are trying to constrain an associated type. The last commit now accounts for references. I have these checks because I want to avoid incorrect suggestions, as that is more harmful than not providing a suggestion we could have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, this will not help for a case like <(T, T) as Trait>::Assoc: String
.
@bors r+ |
📌 Commit 4ae8f6e has been approved by |
☀️ Test successful - checks-actions, checks-azure |
When finding an ADT in a trait object definition provide some solutions. Fix #45817.
Given
<Param as Trait>::Assoc: Ty
suggestParam: Trait<Assoc = Ty>
. Fix #75829.