-
Notifications
You must be signed in to change notification settings - Fork 13.4k
diagnostics: "one type is more general" for two identical types? #75791
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Just for the record, the working code was |
I'm on the street right now. If someone can identify the nightly the output changed I can track the pr and hopefully see how we can fox it back tomorrow. |
Marking this as P-high based on the wg-prioritization discussion |
I tried to get cargo-bisect-rustc to work and it seems the regressing merge is 1557fb0 |
This is almost certainly due to #72493. The error seems legit, as discussed here. The error message is quite misleading, what's really happening is that the type of |
discussed in T-compiler meeting. Assigning to @estebank to see if they can make progress on it over next week. Also nominating to ensure we circle back around to it next week if progress isn't made |
Is this one a stable regression now?, also is it the same as #74400 ? |
yes that's on stable now |
and to answer the question: both are indeed duplicates of each other, they are higher-ranked subtype errors involving placeholder regions from the same universe. NLL's nice region error reporting code doesn't kick in because it handles TraitRefs while these are PolyTraitRefs. |
I can get the following output:
But I feel it is not yet ideal. |
Is there enough information at this point of type-checking to output either previous errors (or both ? the E0631 seems more user-friendly, but these spans look more like the previous E0271), so that even if the message doesn't improve it at least doesn't regress anymore ? Maybe having the previous signatures would be clearer ?
I wonder how we should explain these kinds of errors, maybe linking to closures/Fn* documentation, suggesting wrapping in a closure (but that doesn't always work). Maybe those suggestions are also too tailored to these 2 specific issues but higher-ranked subtyping errors could be arbitrarily complicated. |
Adding |
As noted this is a stable regression already, adjusting labels accordingly. |
I hope this is the right place for this — it seems like all relevant issues are getting closed as duplicates of this one. For reference, here is more minimal reproduction of the problem, from @khyperia: fn thing(x: impl FnOnce(&u32)) {}
fn main() {
let f = |_| ();
thing(f);
} It can be worked around like this: fn thing(x: impl FnOnce(&u32)) {}
fn main() {
let f = |_: &_| ();
thing(f);
} |
Current output:
I think this might be a duplicate of #71723 |
Closing as a duplicate of #71723 |
While looking through some clippy lint warnings in rust-lang/rust-clippy#5939 I found this very confusing error message:
note that
expected type
andfound type
are identical which is not helpful 😅This happens on
and also on
1.46.0-beta.4
.On stable
1.45.2
, the message looks different though:The text was updated successfully, but these errors were encountered: