@@ -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
}
@@ -741,7 +744,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
741
744
}
742
745
}
743
746
744
- fn lower_trait_item ( & mut self , i : & AssocItem , trait_constness : Const ) -> & ' hir hir:: TraitItem < ' hir > {
747
+ fn lower_trait_item (
748
+ & mut self ,
749
+ i : & AssocItem ,
750
+ trait_constness : Const ,
751
+ ) -> & ' hir hir:: TraitItem < ' hir > {
745
752
let hir_id = self . lower_node_id ( i. id ) ;
746
753
self . lower_attrs ( hir_id, & i. attrs ) ;
747
754
let trait_item_def_id = hir_id. expect_owner ( ) ;
@@ -867,7 +874,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
867
874
self . expr ( span, hir:: ExprKind :: Err ( guar) )
868
875
}
869
876
870
- fn lower_impl_item ( & mut self , i : & AssocItem , impl_constness : Const ) -> & ' hir hir:: ImplItem < ' hir > {
877
+ fn lower_impl_item (
878
+ & mut self ,
879
+ i : & AssocItem ,
880
+ impl_constness : Const ,
881
+ ) -> & ' hir hir:: ImplItem < ' hir > {
871
882
// Since `default impl` is not yet implemented, this is always true in impls.
872
883
let has_value = true ;
873
884
let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
@@ -1320,7 +1331,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1320
1331
let header = self . lower_fn_header ( sig. header ) ;
1321
1332
// Don't pass along the user-provided constness of trait associated functions; we don't want to
1322
1333
// synthesize a host effect param for them. We reject `const` on them during AST validation.
1323
- let constness = if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1334
+ let constness =
1335
+ if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1324
1336
let itctx = ImplTraitContext :: Universal ;
1325
1337
let ( generics, decl) = self . lower_generics ( generics, constness, id, itctx, |this| {
1326
1338
this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coroutine_kind)
0 commit comments