Skip to content

Commit f8081aa

Browse files
Rollup merge of #153894 - estebank:issue-129792, r=nnethercote
Point at unit structs on foreign crates in type errors when they are the pattern of a binding Consts and unit structs in patterns can be confusing if they are mistaken for new bindings. We already provide some context for unit structs and consts that come from the current crate, we now also point at those from foreign crates, and we properly skip cases where the pattern has type parameters which can't be confused with a new binding. So not suggest making a new binding when other suggestions are already emitted, as the likelihood of the other suggestions being what the user intended is higher. Make new binding suggestion verbose. Fix rust-lang/rust#129792. ``` error[E0308]: mismatched types --> fi.rs:8:9 | 1 | struct percentage; | ----------------- unit struct defined here ... 8 | let percentage = 4i32; | ^^^^^^^^^^ ---- this expression has type `i32` | | | expected `i32`, found `percentage` | `percentage` is interpreted as a unit struct, not a new binding help: introduce a new binding instead | 8 - let percentage = 4i32; 8 + let other_percentage = 4i32; | ```
2 parents 67843dd + 1a17d88 commit f8081aa

0 file changed

File tree

    0 commit comments

    Comments
     (0)