Closed
Description
Just an idea:
Let's say our code looks like this:
fn main() {
{
{
{
println!("Hello, world!");
}
}
}
The error message is not very helpful here, pointing to lines 1 and 8:
error: this file contains an un-closed delimiter
--> src/main.rs:8:3
|
8 | }
| ^
|
help: did you mean to close this delimiter?
--> src/main.rs:1:11
|
1 | fn main() {
| ^
However, since cargo inits new repos as git repo, maybe we can utilize the repo diff and see which brace was added the last:
fn main() {
{
{
- println!("Hello, world!");
+ {
+ println!("Hello, world!");
}
}
}
and give a better diagnostic:
error: this file contains an un-closed delimiter
--> src/main.rs:8:3
|
8 | }
| ^
|
help: did you mean to close this delimiter?
--> src/main.rs:4:12
|
4 | {
| ^
```