-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
for<'a> Fn(<A as B<'a>>::C)
fails incosistently and requires unnecessary type annotations
#90875
Comments
@rustbot label T-compiler, A-typesystem, A-lifetimes, A-inference, A-closures, A-traits |
Prior to v1.56, closures and functions all fail alike with the same error message and adding type annotations didn't help either. So my guess is that #85499 (edit: and #88441) introduced an (incomplete?) fix, so I think this now needs to:
@rustbot label A-diagnostics |
While changing the error message could improve the situation, this is clearly not exclusively a diagnostics issue, AFAICT. To avoid potential confusion, let me remove the A-diagnostics label, which is commonly applied to issues that are purely diagnostics issues. @rustbot label -A-diagnostics. In case it is decided that this is only a diagnostics issue after all, the label can be reapplied. In case the inconsistency is somehow fixed and diagnostics issues remain, a new A-diagnostics issue can be opened. |
I've just been aware of the version differences and recent efforts to solve this. So here is a summary:
A duplicate of #89436. |
#89436 closed as a dupe, there are additional testcases in that issue that should probably be checked when fixing this. |
Add a couple tests for rust-lang#90887 fixes closes rust-lang#56556 closes rust-lang#90875 These are confirmed fixes by rust-lang#90887, so r? `@jackh726`
I tried this code:
(playground)
I expected to see this happen: the code compiles fine.
Instead, this happened:
check(fn_1)
andcheck(fn_4)
fails to type check, and although the error message is not related to type inference, annotating the type parameterT
fixes the problem. the same thing happens when removing the boundF: Fn(T)
, but then for allcheck(fn_*)
.Seems to be related to #79207. cc @jackh726
Error message
Context
Original thread in users forum
Meta
Tested on
stable andnightly branches of playground:Stable version: 1.56.1The text was updated successfully, but these errors were encountered: