]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_ast_lowering/lib.rs
Forbid elided lifetimes within const generic parameter types.
[rust.git] / src / librustc_ast_lowering / lib.rs
index 58b8e8a089ad31137380c1584b39b01c875b3174..9775871a11bfeb1b8f137c378ae2ed9654fefeff 100644 (file)
@@ -2121,12 +2121,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 {