1
Fork 0

Rollup merge of #111531 - chenyukang:yukang-fix-111416-ice, r=compiler-errors

Fix ice caused by shorthand fields in NoFieldsForFnCall

Fixes #111416
This commit is contained in:
Matthias Krüger 2023-05-15 10:58:39 +02:00 committed by GitHub
commit 7a1f3e7a88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View file

@ -1180,6 +1180,10 @@ 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(|field| !field.is_shorthand).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