Closed
Description
Given:
struct f; fn main() { let f = 1; }
a rust compiler (playground, stable) will error with:
error[E0308]: mismatched types
--> src/main.rs:1:27
|
1 | struct f; fn main() { let f = 1; }
| ^ expected integral variable, found struct `f`
|
= note: expected type `{integer}`
found type `f`
this is morally right; but the error message could highlight the fact that the user most likely confused the pattern f
(as in the equivalent unit struct pattern f {}
) with a variable binding f
.
Tho, the names coinciding is somewhat pathological, so it might not warrant special care; but perhaps it does?