From ce6cfc37d033eb1fb1f2e3af1c17c218917b54ec Mon Sep 17 00:00:00 2001 From: yukang Date: Sat, 13 May 2023 18:06:16 +0800 Subject: Fix ice caused by shorthand fields in NoFieldsForFnCall --- compiler/rustc_parse/src/parser/expr.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/rustc_parse/src/parser') 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 -- cgit 1.4.1-3-g733a5