Closed
Description
I tried this code:
pub enum ErrorHandled {
Reported,
TooGeneric,
}
impl ErrorHandled {
pub fn assert_reported(self) {
match self {
ErrorHandled::Reported => {}
ErrorHandled::TooGeneric => panic!(),
}
}
}
fn struct_generic(x: Vec<i32>) {
for v in x {
println!("{}", v);
}
} // <-- incorrect closing brace
}
I expected to see this happen: Some more or less helpful message about the imbalanced braces.
Instead, this happened: I got a rather confusing suggestion:
error: unexpected closing delimiter: `}`
--> src/lib.rs:20:1
|
9 | ErrorHandled::Reported => {}
| -- this block is empty, you might have not meant to close it
...
20 | }
| ^ unexpected closing delimiter
The empty block it points to is not even in the same function, so this suggestion is more confusing than helpful.
This issue has been assigned to @kper via this comment.