-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Diagnostics talk about fn pointer
when no pointers are in the source
#67296
Comments
cc @estebank |
What are some appropriate wordings? fn signature? fn? fn type? Revert this one back to just type? |
Maybe without any descriptive word?
Is there any particular reason we're displaying the note at all? In the examples I was able to coax out of the compiler the main message was the part that was helpful, the note was just redundant. |
This used to be "expected type" which was also confusing when showing things that weren't really something that people associated with types, so it's using the TyKind description now. We could remove it entirely, but I find that having a small level of redundancy in our wording can help introduce and teach concepts to new users. This is why when I saw this I didn't change this to something like "function", but I'm really happy you opened this conversation. |
Yea that was quite suboptimal
Right, having different verbosity levels for different experience levels is a different discussion, so: more verbosity is better for now. What do you think about
or does that get too long for complex signatures? |
It makes sense but seems a bit long, I wonder if we can simultaneously make it shorter and less "jargony" by doing something like (for fn pointers specifically):
|
Oh yea, that's good |
Original problem is fixed by #106131, not sure about the rest of the discussion but probably should be moved to a different issue. |
Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible Fixes rust-lang#80929 Fixes rust-lang#67296
Trait function API mismatches (where the impl differs from the declaration) report the correct error about the mismatch, but also give a more detailed note like
This could cause some confusion as the user hasn't done anything with function pointers.
(Playground)
Errors:
The text was updated successfully, but these errors were encountered: