@@ -601,9 +601,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
601
601
hir:: Constness :: NotConst => Const :: No ,
602
602
}
603
603
}
604
- hir:: ItemKind :: Trait ( _, _, _, _, _) => {
605
- parent_hir. attrs . get ( parent_item. hir_id ( ) . local_id ) . iter ( ) . find ( |attr| attr. has_name ( sym:: const_trait) ) . map_or ( Const :: No , |attr| Const :: Yes ( attr. span ) )
606
- } ,
604
+ hir:: ItemKind :: Trait ( _, _, _, _, _) => parent_hir
605
+ . attrs
606
+ . get ( parent_item. hir_id ( ) . local_id )
607
+ . iter ( )
608
+ . find ( |attr| attr. has_name ( sym:: const_trait) )
609
+ . map_or ( Const :: No , |attr| Const :: Yes ( attr. span ) ) ,
607
610
kind => {
608
611
span_bug ! ( item. span, "assoc item has unexpected kind of parent: {}" , kind. descr( ) )
609
612
}
@@ -738,7 +741,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
738
741
}
739
742
}
740
743
741
- fn lower_trait_item ( & mut self , i : & AssocItem , trait_constness : Const ) -> & ' hir hir:: TraitItem < ' hir > {
744
+ fn lower_trait_item (
745
+ & mut self ,
746
+ i : & AssocItem ,
747
+ trait_constness : Const ,
748
+ ) -> & ' hir hir:: TraitItem < ' hir > {
742
749
let hir_id = self . lower_node_id ( i. id ) ;
743
750
self . lower_attrs ( hir_id, & i. attrs ) ;
744
751
let trait_item_def_id = hir_id. expect_owner ( ) ;
@@ -864,7 +871,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
864
871
self . expr ( span, hir:: ExprKind :: Err ( guar) )
865
872
}
866
873
867
- fn lower_impl_item ( & mut self , i : & AssocItem , impl_constness : Const ) -> & ' hir hir:: ImplItem < ' hir > {
874
+ fn lower_impl_item (
875
+ & mut self ,
876
+ i : & AssocItem ,
877
+ impl_constness : Const ,
878
+ ) -> & ' hir hir:: ImplItem < ' hir > {
868
879
// Since `default impl` is not yet implemented, this is always true in impls.
869
880
let has_value = true ;
870
881
let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
@@ -1317,7 +1328,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1317
1328
let header = self . lower_fn_header ( sig. header ) ;
1318
1329
// Don't pass along the user-provided constness of trait associated functions; we don't want to
1319
1330
// synthesize a host effect param for them. We reject `const` on them during AST validation.
1320
- let constness = if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1331
+ let constness =
1332
+ if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1321
1333
let itctx = ImplTraitContext :: Universal ;
1322
1334
let ( generics, decl) = self . lower_generics ( generics, constness, id, itctx, |this| {
1323
1335
this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coroutine_kind)
0 commit comments