about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-05-13 18:06:16 +0800
committeryukang <moorekang@gmail.com>2023-05-13 18:06:16 +0800
commitce6cfc37d033eb1fb1f2e3af1c17c218917b54ec (patch)
treebed6cfba9c4f2695202b44891c78d26d6dc98256 /compiler/rustc_parse/src/parser/expr.rs
parent69fef92ab2f287f072b66fb7b4f62c8bb4acba43 (diff)
downloadrust-ce6cfc37d033eb1fb1f2e3af1c17c218917b54ec.tar.gz
rust-ce6cfc37d033eb1fb1f2e3af1c17c218917b54ec.zip
Fix ice caused by shorthand fields in NoFieldsForFnCall
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 887e155426f..808bbbdada6 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1180,6 +1180,13 @@ impl<'a> Parser<'a> {
                         self.restore_snapshot(snapshot);
                         let close_paren = self.prev_token.span;
                         let span = lo.to(close_paren);
+                        // filter shorthand fields
+                        let fields: Vec<_> = fields
+                            .into_iter()
+                            .filter_map(
+                                |field| if !field.is_shorthand { Some(field) } else { None },
+                            )
+                            .collect();
                         if !fields.is_empty() &&
                             // `token.kind` should not be compared here.
                             // This is because the `snapshot.token.kind` is treated as the same as