summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 1c2df3ffcd1..e1e6b93abf3 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1397,7 +1397,9 @@ impl<'a> Parser<'a> {
         } else if let Some(expr) = self.eat_metavar_seq_with_matcher(
             |mv_kind| matches!(mv_kind, MetaVarKind::Expr { .. }),
             |this| {
-                let expr = this.parse_expr();
+                // Force collection (as opposed to just `parse_expr`) is required to avoid the
+                // attribute duplication seen in #138478.
+                let expr = this.parse_expr_force_collect();
                 // FIXME(nnethercote) Sometimes with expressions we get a trailing comma, possibly
                 // related to the FIXME in `collect_tokens_for_expr`. Examples are the multi-line
                 // `assert_eq!` calls involving arguments annotated with `#[rustfmt::skip]` in