]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast_lowering/src/expr.rs
Auto merge of #107010 - weihanglo:update-cargo, r=weihanglo
[rust.git] / compiler / rustc_ast_lowering / src / expr.rs
index 3634e6e47ce12e220d3b64f2fa4e6be9eb8b004d..c3611b2f522babd789e589285b1e6359e1f11b18 100644 (file)
@@ -209,6 +209,7 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> {
                 ExprKind::Closure(box Closure {
                     binder,
                     capture_clause,
+                    constness,
                     asyncness,
                     movability,
                     fn_decl,
@@ -233,6 +234,7 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> {
                             binder,
                             *capture_clause,
                             e.id,
+                            *constness,
                             *movability,
                             fn_decl,
                             body,
@@ -651,6 +653,7 @@ pub(super) fn make_async_expr(
                 fn_decl_span: self.lower_span(span),
                 fn_arg_span: None,
                 movability: Some(hir::Movability::Static),
+                constness: hir::Constness::NotConst,
             });
 
             hir::ExprKind::Closure(c)
@@ -689,8 +692,8 @@ pub(super) fn make_async_expr(
         // call (like the identity function), as otherwise type and lifetime
         // inference have a hard time figuring things out.
         // Without this, we would get:
-        // E0720 in src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs
-        // E0700 in src/test/ui/self/self_lifetime-async.rs
+        // E0720 in tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+        // E0700 in tests/ui/self/self_lifetime-async.rs
 
         // `future::identity_future`:
         let identity_future =
@@ -890,6 +893,7 @@ fn lower_expr_closure(
         binder: &ClosureBinder,
         capture_clause: CaptureBy,
         closure_id: NodeId,
+        constness: Const,
         movability: Movability,
         decl: &FnDecl,
         body: &Expr,
@@ -927,6 +931,7 @@ fn lower_expr_closure(
             fn_decl_span: self.lower_span(fn_decl_span),
             fn_arg_span: Some(self.lower_span(fn_arg_span)),
             movability: generator_option,
+            constness: self.lower_constness(constness),
         });
 
         hir::ExprKind::Closure(c)
@@ -1041,6 +1046,7 @@ fn lower_expr_async_closure(
             fn_decl_span: self.lower_span(fn_decl_span),
             fn_arg_span: Some(self.lower_span(fn_arg_span)),
             movability: None,
+            constness: hir::Constness::NotConst,
         });
         hir::ExprKind::Closure(c)
     }