Closed
Description
fn main() {
for _ in std::ops::Range { start: 0, end: 10 } {}
}
// error: expected type, found `0`
// --> src/main.rs:2:39
// |
// 2 | for _ in std::ops::Range { start: 0, end: 10 } {}
// | ^ expecting a type here because of type ascription
// error[E0423]: expected value, found struct `std::ops::Range`
// --> src/main.rs:2:14
// |
// 2 | for _ in std::ops::Range { start: 0, end: 10 } {}
// | ^^^^^^^^^^^^^^^ did you mean `std::ops::Range { /* fields */ }`?
It's confusing here, as it suggests using exactly what the user has typed. It should instead suggest the user parenthesise the struct literal.
(There's probably a reason this doesn't parse as-is, but if not, it seems like a nice case to handle.)