-
Notifications
You must be signed in to change notification settings - Fork 13.4k
recurse into refs when comparing tys for diagnostics #118730
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
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
note that the decision of whether to fully elide the type as rust/compiler/rustc_infer/src/infer/error_reporting/mod.rs Lines 1510 to 1512 in eb53721
|
= note: expected reference `&Foo<_, B>` | ||
found struct `Foo<_, A>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Interesting that we have a likely improvement here!
@@ -4,8 +4,8 @@ error[E0308]: mismatched types | |||
LL | debug_assert_eq!(iter.next(), Some(value)); | |||
| ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like maybe we should use the expected/found ones now instead for the label, as they end up being significantly shorter.
= note: expected reference `&_` | ||
found type parameter `_` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we didn't use _
as a placeholder here, but whatever. This is still pretty helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors r=estebank,compiler-errors |
💡 This pull request was already approved, no need to approve it again.
|
…er-errors recurse into refs when comparing tys for diagnostics before:  after:  this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
Future work: highlight the relevant part of trait objects and impl Traits. |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#117586 (Uplift the (new solver) canonicalizer into `rustc_next_trait_solver`) - rust-lang#118692 (remove redundant imports) - rust-lang#118694 (Add instance evaluation and methods to read an allocation in StableMIR) - rust-lang#118715 (privacy: visit trait def id of projections) - rust-lang#118730 (recurse into refs when comparing tys for diagnostics) - rust-lang#118736 (temporarily revert "ice on ambguity in mir typeck") r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#117586 (Uplift the (new solver) canonicalizer into `rustc_next_trait_solver`) - rust-lang#118502 (fix: correct the arg for 'suggest to use associated function syntax' diagnostic) - rust-lang#118694 (Add instance evaluation and methods to read an allocation in StableMIR) - rust-lang#118715 (privacy: visit trait def id of projections) - rust-lang#118730 (recurse into refs when comparing tys for diagnostics) - rust-lang#118736 (temporarily revert "ice on ambguity in mir typeck") r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#118730 - jyn514:cmp_refs, r=estebank,compiler-errors recurse into refs when comparing tys for diagnostics before:  after:  this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
before:

after:

this diff from the test suite is also quite nice imo: