Emit unclosed delimiters during recovery

This commit is contained in:
Esteban Küber 2019-03-01 22:14:22 -08:00
parent cc535a2a19
commit ed2de5a842
3 changed files with 14 additions and 1 deletions

View File

@ -778,6 +778,7 @@ impl<'a> Parser<'a> {
// leave it in the input
Ok(false)
} else if self.last_unexpected_token_span == Some(self.span) {
emit_unclosed_delims(&self.unclosed_delims, self.diagnostic());
FatalError.raise();
} else {
let mut expected = edible.iter()

View File

@ -5,4 +5,8 @@ impl A {
//~^ ERROR expected one of `)`, `,`, or `:`, found `>`
}
// verify that mismatched delimiters get emitted
fn foo(] {}
//~^ ERROR incorrect close delimiter
fn main() {}

View File

@ -7,5 +7,13 @@ LL | fn b(self> {}
| | help: `)` may belong here
| unclosed delimiter
error: aborting due to previous error
error: incorrect close delimiter: `]`
--> $DIR/issue-58856-1.rs:9:8
|
LL | fn foo(] {}
| -^ incorrect close delimiter
| |
| un-closed delimiter
error: aborting due to 2 previous errors