]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_ast_lowering/lib.rs
Rollup merge of #68340 - GuillaumeGomez:clean-up-e0200, r=Dylan-DPC
[rust.git] / src / librustc_ast_lowering / lib.rs
index d30d0bd8345fff22d2f00f3e77f1db27567b8166..76a0889c376a22b1367ebf67fcec7cb21dbf249a 100644 (file)
@@ -2120,12 +2120,14 @@ fn lower_generic_param(
 
                 (hir::ParamName::Plain(param.ident), kind)
             }
-            GenericParamKind::Const { ref ty } => (
-                hir::ParamName::Plain(param.ident),
-                hir::GenericParamKind::Const {
-                    ty: self.lower_ty(&ty, ImplTraitContext::disallowed()),
-                },
-            ),
+            GenericParamKind::Const { ref ty } => {
+                let ty = self
+                    .with_anonymous_lifetime_mode(AnonymousLifetimeMode::ReportError, |this| {
+                        this.lower_ty(&ty, ImplTraitContext::disallowed())
+                    });
+
+                (hir::ParamName::Plain(param.ident), hir::GenericParamKind::Const { ty })
+            }
         };
 
         hir::GenericParam {