diff options
author | Dylan MacKenzie <[email protected]> | 2019-08-24 00:08:33 +0100 |
---|---|---|
committer | Dylan MacKenzie <[email protected]> | 2019-08-24 00:20:18 +0100 |
commit | c08ad1cf8ac2a81e9a772eddccaecbd2a6883edd (patch) | |
tree | 139177510c6576cfdacdf375948684bff81df22f /crates | |
parent | 83433cd1f0ce2ebe1818caa6793f61372e4fa5a6 (diff) |
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.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_parser/src/grammar/patterns.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs index f9e6de13c..eae70ab85 100644 --- a/crates/ra_parser/src/grammar/patterns.rs +++ b/crates/ra_parser/src/grammar/patterns.rs | |||
@@ -161,6 +161,9 @@ fn record_field_pat_list(p: &mut Parser) { | |||
161 | T![..] => p.bump(), | 161 | T![..] => p.bump(), |
162 | IDENT if p.nth(1) == T![:] => record_field_pat(p), | 162 | IDENT if p.nth(1) == T![:] => record_field_pat(p), |
163 | T!['{'] => error_block(p, "expected ident"), | 163 | T!['{'] => error_block(p, "expected ident"), |
164 | T![box] => { | ||
165 | box_pat(p); | ||
166 | } | ||
164 | _ => { | 167 | _ => { |
165 | bind_pat(p, false); | 168 | bind_pat(p, false); |
166 | } | 169 | } |