@@ -585,9 +585,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
585
585
hir:: Constness :: NotConst => Const :: No ,
586
586
}
587
587
}
588
- hir:: ItemKind :: Trait ( _, _, _, _, _) => {
589
- 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 ) )
590
- } ,
588
+ hir:: ItemKind :: Trait ( _, _, _, _, _) => parent_hir
589
+ . attrs
590
+ . get ( parent_item. hir_id ( ) . local_id )
591
+ . iter ( )
592
+ . find ( |attr| attr. has_name ( sym:: const_trait) )
593
+ . map_or ( Const :: No , |attr| Const :: Yes ( attr. span ) ) ,
591
594
kind => {
592
595
span_bug ! ( item. span, "assoc item has unexpected kind of parent: {}" , kind. descr( ) )
593
596
}
@@ -722,7 +725,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
722
725
}
723
726
}
724
727
725
- fn lower_trait_item ( & mut self , i : & AssocItem , trait_constness : Const ) -> & ' hir hir:: TraitItem < ' hir > {
728
+ fn lower_trait_item (
729
+ & mut self ,
730
+ i : & AssocItem ,
731
+ trait_constness : Const ,
732
+ ) -> & ' hir hir:: TraitItem < ' hir > {
726
733
let hir_id = self . lower_node_id ( i. id ) ;
727
734
self . lower_attrs ( hir_id, & i. attrs ) ;
728
735
let trait_item_def_id = hir_id. expect_owner ( ) ;
@@ -850,7 +857,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
850
857
self . expr ( span, hir:: ExprKind :: Err ( guar) )
851
858
}
852
859
853
- fn lower_impl_item ( & mut self , i : & AssocItem , impl_constness : Const ) -> & ' hir hir:: ImplItem < ' hir > {
860
+ fn lower_impl_item (
861
+ & mut self ,
862
+ i : & AssocItem ,
863
+ impl_constness : Const ,
864
+ ) -> & ' hir hir:: ImplItem < ' hir > {
854
865
// Since `default impl` is not yet implemented, this is always true in impls.
855
866
let has_value = true ;
856
867
let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
@@ -1304,7 +1315,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1304
1315
let header = self . lower_fn_header ( sig. header ) ;
1305
1316
// Don't pass along the user-provided constness of trait associated functions; we don't want to
1306
1317
// synthesize a host effect param for them. We reject `const` on them during AST validation.
1307
- let constness = if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1318
+ let constness =
1319
+ if kind == FnDeclKind :: Inherent { sig. header . constness } else { parent_constness } ;
1308
1320
let itctx = ImplTraitContext :: Universal ;
1309
1321
let ( generics, decl) = self . lower_generics ( generics, constness, id, & itctx, |this| {
1310
1322
this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coroutine_kind)
0 commit comments