-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #127955 - chenyukang:yukang-fix-mismatched-delimiter-is…
…sue-12786, r=nnethercote Add limit for unclosed delimiters in lexer diagnostic Fixes #127868 The first commit shows the original diagnostic, and the second commit shows the changes.
- Loading branch information
Showing
4 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// issue: rust-lang/rust#127868 | ||
|
||
fn main() { | ||
let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; | ||
} //~ ERROR mismatched closing delimiter: `}` | ||
//~ ERROR this file contains an unclosed delimiter |
30 changes: 30 additions & 0 deletions
30
tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error: mismatched closing delimiter: `}` | ||
--> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:4:42 | ||
| | ||
LL | fn main() { | ||
| - closing delimiter possibly meant for this | ||
LL | let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; | ||
| ^ unclosed delimiter | ||
LL | } | ||
| ^ mismatched closing delimiter | ||
|
||
error: this file contains an unclosed delimiter | ||
--> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:6:52 | ||
| | ||
LL | fn main() { | ||
| - unclosed delimiter | ||
LL | let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; | ||
| ----- - this delimiter might not be properly closed... | ||
| ||||| | ||
| ||||another 16 unclosed delimiters begin from here | ||
| |||unclosed delimiter | ||
| ||unclosed delimiter | ||
| |unclosed delimiter | ||
| unclosed delimiter | ||
LL | } | ||
| - ...as it matches this but it has different indentation | ||
LL | | ||
| ^ | ||
|
||
error: aborting due to 2 previous errors | ||
|