diff --git a/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs new file mode 100644 index 00000000000..edf619664e3 --- /dev/null +++ b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.rs @@ -0,0 +1,7 @@ +// ignore-tidy-trailing-newlines +// issue: rust-lang/rust#127868 + +fn main() { + let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; +} //~ ERROR mismatched closing delimiter: `}` +//~ ERROR this file contains an unclosed delimiter \ No newline at end of file diff --git a/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr new file mode 100644 index 00000000000..95e2bf91642 --- /dev/null +++ b/tests/ui/parser/mismatched-delimiter-corner-case-issue-127868.stderr @@ -0,0 +1,45 @@ +error: mismatched closing delimiter: `}` + --> $DIR/mismatched-delimiter-corner-case-issue-127868.rs:5: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:7:51 + | +LL | fn main() { + | - unclosed delimiter +LL | let a = [[[[[[[[[[[[[[[[[[[[1, {, (, [,; + | -------------------- - this delimiter might not be properly closed... + | |||||||||||||||||||| + | |||||||||||||||||||unclosed delimiter + | ||||||||||||||||||unclosed delimiter + | |||||||||||||||||unclosed delimiter + | ||||||||||||||||unclosed delimiter + | |||||||||||||||unclosed delimiter + | ||||||||||||||unclosed delimiter + | |||||||||||||unclosed delimiter + | ||||||||||||unclosed delimiter + | |||||||||||unclosed delimiter + | ||||||||||unclosed delimiter + | |||||||||unclosed delimiter + | ||||||||unclosed delimiter + | |||||||unclosed delimiter + | ||||||unclosed delimiter + | |||||unclosed delimiter + | ||||unclosed delimiter + | |||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 +