@@ -182,7 +182,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
182
182
self . lower_use_tree ( use_tree, & prefix, id, vis_span, ident, attrs)
183
183
}
184
184
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 ) ;
186
187
hir:: ItemKind :: Static ( ty, * m, body_id)
187
188
}
188
189
ItemKind :: Const ( box ast:: ConstItem { generics, ty, expr, .. } ) => {
@@ -191,7 +192,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
191
192
Const :: No ,
192
193
id,
193
194
& 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
+ } ,
195
198
) ;
196
199
hir:: ItemKind :: Const ( ty, generics, body_id)
197
200
}
@@ -448,8 +451,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
448
451
ty : & Ty ,
449
452
span : Span ,
450
453
body : Option < & Expr > ,
454
+ impl_trait_position : ImplTraitPosition ,
451
455
) -> ( & ' 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 ) ) ;
453
457
( ty, self . lower_const_body ( span, body) )
454
458
}
455
459
0 commit comments