@@ -585,9 +585,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
585585 hir:: Constness :: NotConst => Const :: No ,
586586 }
587587 }
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 ) ) ,
591594 kind => {
592595 span_bug ! ( item. span, "assoc item has unexpected kind of parent: {}" , kind. descr( ) )
593596 }
@@ -722,7 +725,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
722725 }
723726 }
724727
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 > {
726733 let hir_id = self . lower_node_id ( i. id ) ;
727734 self . lower_attrs ( hir_id, & i. attrs ) ;
728735 let trait_item_def_id = hir_id. expect_owner ( ) ;
@@ -850,7 +857,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
850857 self . expr ( span, hir:: ExprKind :: Err ( guar) )
851858 }
852859
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 > {
854865 // Since `default impl` is not yet implemented, this is always true in impls.
855866 let has_value = true ;
856867 let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
@@ -1304,7 +1315,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
13041315 let header = self . lower_fn_header ( sig. header ) ;
13051316 // Don't pass along the user-provided constness of trait associated functions; we don't want to
13061317 // 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 } ;
13081320 let itctx = ImplTraitContext :: Universal ;
13091321 let ( generics, decl) = self . lower_generics ( generics, constness, id, & itctx, |this| {
13101322 this. lower_fn_decl ( & sig. decl , id, sig. span , kind, coroutine_kind)
0 commit comments