diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-31 16:32:55 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-02 06:21:18 +1100 |
| commit | 592d113ff24b91290022d9f1aae271598ff235fa (patch) | |
| tree | 674ea0c2778bc439873b761a82a83a97404af16e /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 81afdbc161300549bb5bbfe0bec5c1a60e11243d (diff) | |
| download | rust-592d113ff24b91290022d9f1aae271598ff235fa.tar.gz rust-592d113ff24b91290022d9f1aae271598ff235fa.zip | |
Fix problem causing `rusqlite` compilation to OOM.
This makes the expression re-parsing more like how it's originally done in `parse_nonterminal`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 4 |
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 |
