-
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
Printed function definition types can be confusing #69232
Comments
That's not the same type, it just prints "fn item" in a very similar way to "fn pointer". The former is zero-sized, while the latter is pointer-sized. |
Are you saying that the |
Yeah, it indicates that it's the type of that specific fn item, and not an fn pointer. |
That... is really not obvious. |
I agree it isn't; but on the other hand I'm not sure what would be clear without also taking up a lot of space... ideas? cc @estebank |
An option would be to move the function name after the fn instead of after the signature, but doubt that would be enough. Best bet would be to add extra wording to the message about this being a specific function and expecting a function pointer, but the wording of those two is too close and lends itself to the same confusion we have now. Because of that, I think we should add a note explaining the nuance for these cases. |
How about something like this?
I'd argue that confusion comes from seeing the "same" function signature so many times, so it's vital to distinguish between the individual function type vs the function pointer type as much (and as obviously) as possible. |
@rustbot release-assignment |
@rustbot assign |
Error: Parsing assign command in comment failed: ...'bot assign' | error: specify user to assign to at >| ''... Please let |
@rustbot claim |
@rustbot claim |
…iler-errors Better diagnostic for fn items in variadic functions closes rust-lang#69232
…iler-errors Better diagnostic for fn items in variadic functions closes rust-lang#69232
Rollup merge of rust-lang#133538 - dev-ardi:69232-better-diag, r=compiler-errors Better diagnostic for fn items in variadic functions closes rust-lang#69232
I tried this code:
I expected to see this happen: maybe not a failure, or a failure that is not completely confusing.
Instead, this happened:
Note how it suggests to cast to the exact same type it started with.
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: