@@ -182,7 +182,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
182182 self . lower_use_tree ( use_tree, & prefix, id, vis_span, ident, attrs)
183183 }
184184 ItemKind :: Static ( box ast:: StaticItem { ty : t, mutability : m, expr : e } ) => {
185- let ( ty, body_id) = self . lower_const_item ( t, span, e. as_deref ( ) ) ;
185+ let ( ty, body_id) =
186+ self . lower_const_item ( t, span, e. as_deref ( ) , ImplTraitPosition :: StaticTy ) ;
186187 hir:: ItemKind :: Static ( ty, * m, body_id)
187188 }
188189 ItemKind :: Const ( box ast:: ConstItem { generics, ty, expr, .. } ) => {
@@ -191,7 +192,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
191192 Const :: No ,
192193 id,
193194 & ImplTraitContext :: Disallowed ( ImplTraitPosition :: Generic ) ,
194- |this| this. lower_const_item ( ty, span, expr. as_deref ( ) ) ,
195+ |this| {
196+ this. lower_const_item ( ty, span, expr. as_deref ( ) , ImplTraitPosition :: ConstTy )
197+ } ,
195198 ) ;
196199 hir:: ItemKind :: Const ( ty, generics, body_id)
197200 }
@@ -448,8 +451,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
448451 ty : & Ty ,
449452 span : Span ,
450453 body : Option < & Expr > ,
454+ impl_trait_position : ImplTraitPosition ,
451455 ) -> ( & ' hir hir:: Ty < ' hir > , hir:: BodyId ) {
452- let ty = self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
456+ let ty = self . lower_ty ( ty, & ImplTraitContext :: Disallowed ( impl_trait_position ) ) ;
453457 ( ty, self . lower_const_body ( span, body) )
454458 }
455459
0 commit comments