-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Suggest considering casting fn item as fn pointer in more cases #133382
base: master
Are you sure you want to change the base?
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
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.
Thanks for the contribution, but I think this logic is a bit too ad-hoc to land.
As an alternative approach, could you find the logic that ends up producing this note:
for that trait implementation, expected
fn()
foundfn() {foo}
And instead try to add a note there? That logic should be responsible for peeling off all the types until the type mismatch, which should make it much simpler and not require us to reimplement a new kind of method to peel off ADTs to discover fn type mismatches.
@compiler-errors Just checking the found ty and expected ty at fulfillment_errors.rs will work, but it only handles the cases that we know both tys are fns. I want to suggest in more cases, just like the second statement in the test, e.g., Do you think just adding a help for the simple case is enough? If so I can open another PR which will do less ;) |
@mu001999: What I'm saying is that this logic largely replicates, and I don't think I can see why this needs to be reimplemented in a particularly verbose way. When we have a type mismatch like I think that working backwards to understand the function and trying to generalize the existing |
7360a6a
to
74a5827
Compare
Fixes #132648