-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
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 | {
| ^
```
LifeIsStrange and Songbird0zackmdavis
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.