Files
rust/tests/ui/issues/issue-33504.stderr
Esteban Küber 39631fdac1 Point at unit structs on foreign crates in type errors when they are the pattern of a let 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. Make new binding suggestion verbose.
2026-03-15 01:50:36 +00:00

22 lines
586 B
Plaintext

error[E0308]: mismatched types
--> $DIR/issue-33504.rs:7:13
|
LL | struct Test;
| ----------- unit struct defined here
...
LL | let Test = 1;
| ^^^^ - this expression has type `{integer}`
| |
| expected integer, found `Test`
| `Test` is interpreted as a unit struct, not a new binding
|
help: introduce a new binding instead
|
LL - let Test = 1;
LL + let other_test = 1;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.