Skip to content

add UI test for delimiter errors #116034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fn foo() {
match 0 {
_ => {}
}
if foo
}
} //~ ERROR unexpected closing delimiter: `}`

fn main() {}
16 changes: 16 additions & 0 deletions tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error: unexpected closing delimiter: `}`
--> $DIR/issue-98601-delimiter-error-1.rs:7:1
|
LL | fn foo() {
| - this delimiter might not be properly closed...
LL | match 0 {
LL | _ => {}
| -- block is empty, you might have not meant to close it
...
LL | }
| - ...as it matches this but it has different indentation
LL | }
| ^ unexpected closing delimiter

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
todo!();
}

fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: unexpected closing delimiter: `)`
--> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17
|
LL | fn main() {
| - this opening brace...
LL | todo!();
LL | }
| - ...matches this closing brace
LL |
LL | fn other(_: i32)) {}
| ^ unexpected closing delimiter

error: aborting due to previous error