-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Self-contradictory error message about Fn types on beta/nightly #57875
Comments
This is a diagnostics regression given the current stable output (even though it wasn't that good to begin with):
but needs consideration on wether the code as written should be accepted instead. Why are we evaluating to CC @rust-lang/lang |
Is it not just showing |
The workaround is to annotate the closure parameter types so that they get assigned higher-ranked regions or whatever you call them. let lambda = |&x: &_, &y: &_| x + y; This is a well-known problem that has hit many a rustacean. But I thought the error messages used to be more descriptive, saying mething about "concrete" versus "bound" lifetimes. Even if it was terribly confusing language, it was at least something the user could Google. |
This issue is very similar to #57362 on which I have been working (same RegionResolutionError: a SubSupConflict with two placeholder regions and Subtype region origins — but in this case the expected/found values are PolyTraitRefs instead of TraitRefs, bypassing the nice_region_errors into this "mismatched types" fallback which doesn't show the self tys) and I hope to look into this one next. |
Current output (rustc 2023-02-25):
very long, but the problem is made clear |
Really happy to see progress on this front! The last two errors should not be emitted (as they are redundant), but at the very least it should be only one, so I'll leave the ticket open, but I'm ok with the current output as is. |
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e973951415f5092af183ea13d11177cf
See also https://stackoverflow.com/questions/54341465/rust-expected-type-error-prints-mismatched-types-that-are-exactly-the-same?noredirect=1
The text was updated successfully, but these errors were encountered: