diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-09 15:03:56 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-11 21:06:40 +1000 |
| commit | ce78042a42d68d41004803c117c56f5e789dbe67 (patch) | |
| tree | c90456a5e7cf82dd5e369ff2fccaf94e93a5928b /compiler | |
| parent | c32969d8e6f8fc7faa7f265a1a3e2e8c75104094 (diff) | |
| download | rust-ce78042a42d68d41004803c117c56f5e789dbe67.tar.gz rust-ce78042a42d68d41004803c117c56f5e789dbe67.zip | |
Avoid lowering a `MacArgs::Eq` twice.
Fixes #96847.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index fb6715ff17e..3218951c715 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1534,15 +1534,13 @@ impl<'hir> LoweringContext<'_, 'hir> { hir::MatchSource::ForLoopDesugar, )); - let attrs: Vec<_> = e.attrs.iter().map(|a| self.lower_attr(a)).collect(); - // This is effectively `{ let _result = ...; _result }`. // The construct was introduced in #21984 and is necessary to make sure that // temporaries in the `head` expression are dropped and do not leak to the // surrounding scope of the `match` since the `match` is not a terminating scope. // // Also, add the attributes to the outer returned expr node. - self.expr_drop_temps_mut(for_span, match_expr, attrs.into()) + self.expr_drop_temps_mut(for_span, match_expr, e.attrs.clone()) } /// Desugar `ExprKind::Try` from: `<expr>?` into: |
