about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-11 22:53:05 +0200
committerGitHub <noreply@github.com>2022-08-11 22:53:05 +0200
commite221aafae6b21275c9727b45a28b02f347bb48e2 (patch)
tree2d21ab013904e1f7397bcceeaad7b13a88f37c57 /compiler/rustc_ast_lowering/src/expr.rs
parentbd64d67d11ce62ec5242d86ae9efade49f084f70 (diff)
parentce78042a42d68d41004803c117c56f5e789dbe67 (diff)
downloadrust-e221aafae6b21275c9727b45a28b02f347bb48e2.tar.gz
rust-e221aafae6b21275c9727b45a28b02f347bb48e2.zip
Rollup merge of #100307 - nnethercote:fix-96847, r=cjgillot
Fix #96847

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_ast_lowering/src/expr.rs')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs4
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 c7d35fdb1fd..92e6bc6013d 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -1536,15 +1536,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: