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:
commit
d5e7df3dbf
4 changed files with 44 additions and 0 deletions
9
tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
Normal file
9
tests/ui/parser/issues/issue-98601-delimiter-error-1.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
fn foo() {
|
||||||
|
match 0 {
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
if foo
|
||||||
|
}
|
||||||
|
} //~ ERROR unexpected closing delimiter: `}`
|
||||||
|
|
||||||
|
fn main() {}
|
16
tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
Normal file
16
tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr
Normal 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
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
fn main() {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)`
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue