Recover extra trailing angle brackets in struct definition

This commit applies the existing 'extra angle bracket recovery' logic
when parsing fields in struct definitions. This allows us to continue
parsing the struct's fields, avoiding spurious 'missing field' errors in
code that tries to use the struct.
This commit is contained in:
Aaron Hill 2020-06-27 11:35:12 -04:00
parent 7750c3d46b
commit 765bd47fa0
No known key found for this signature in database
GPG key ID: B4087E510E98B164
6 changed files with 66 additions and 8 deletions

View file

@ -0,0 +1,14 @@
// Tests that we recover from extra trailing angle brackets
// in a struct field
struct BadStruct {
first: Vec<u8>>, //~ ERROR unmatched angle bracket
second: bool
}
fn bar(val: BadStruct) {
val.first;
val.second;
}
fn main() {}

View file

@ -0,0 +1,8 @@
error: unmatched angle bracket
--> $DIR/recover-field-extra-angle-brackets.rs:5:19
|
LL | first: Vec<u8>>,
| ^ help: remove extra angle bracket
error: aborting due to previous error