Rollup merge of #116034 - chenyukang:yukang-98601-add-ui-testcase, r=estebank

add UI test for delimiter errors

Fixes #98601
from https://github.com/rust-lang/rust/issues/98601#issuecomment-1721515067
r? `@estebank`
This commit is contained in:
Matthias Krüger 2023-09-22 12:15:26 +02:00 committed by GitHub
commit d5e7df3dbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,9 @@
fn foo() {
match 0 {
_ => {}
}
if foo
}
} //~ ERROR unexpected closing delimiter: `}`
fn main() {}

View file

@ -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

View file

@ -0,0 +1,5 @@
fn main() {
todo!();
}
fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`

View file

@ -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