Skip to content

Commit c08ad1c

Browse files
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.
1 parent 83433cd commit c08ad1c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/ra_parser/src/grammar/patterns.rs

+3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ fn record_field_pat_list(p: &mut Parser) {
161161
T![..] => p.bump(),
162162
IDENT if p.nth(1) == T![:] => record_field_pat(p),
163163
T!['{'] => error_block(p, "expected ident"),
164+
T![box] => {
165+
box_pat(p);
166+
}
164167
_ => {
165168
bind_pat(p, false);
166169
}

0 commit comments

Comments
 (0)