Handle Struct { box i } syntax

Named structs can have `box` patterns that will bind to their fields.
This is similar to the behavior of the `ref` and `mut` fields, but is at
least a little bit surprising.
This commit is contained in:
Dylan MacKenzie 2019-08-23 16:08:33 -07:00
parent 83433cd1f0
commit c08ad1cf8a

View File

@ -161,6 +161,9 @@ fn record_field_pat_list(p: &mut Parser) {
T![..] => p.bump(),
IDENT if p.nth(1) == T![:] => record_field_pat(p),
T!['{'] => error_block(p, "expected ident"),
T![box] => {
box_pat(p);
}
_ => {
bind_pat(p, false);
}