From c08ad1cf8ac2a81e9a772eddccaecbd2a6883edd Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Fri, 23 Aug 2019 16:08:33 -0700 Subject: 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. --- crates/ra_parser/src/grammar/patterns.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_parser/src/grammar/patterns.rs') 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) { 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); } -- cgit v1.2.3