@@ -1224,13 +1224,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12241224 let bound = this. lower_poly_trait_ref (
12251225 & PolyTraitRef {
12261226 bound_generic_params : ThinVec :: new ( ) ,
1227+ modifiers : TraitBoundModifiers :: NONE ,
12271228 trait_ref : TraitRef { path : path. clone ( ) , ref_id : t. id } ,
12281229 span : t. span ,
12291230 } ,
12301231 itctx,
1231- TraitBoundModifiers :: NONE ,
12321232 ) ;
1233- let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
12341233 let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
12351234 let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
12361235 ( bounds, lifetime_bound)
@@ -1357,10 +1356,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13571356 // We can safely ignore constness here since AST validation
13581357 // takes care of rejecting invalid modifier combinations and
13591358 // const trait bounds in trait object types.
1360- GenericBound :: Trait ( ty, modifiers) => {
1361- let trait_ref = this. lower_poly_trait_ref ( ty, itctx, * modifiers) ;
1362- let polarity = this. lower_trait_bound_modifiers ( * modifiers) ;
1363- Some ( ( trait_ref, polarity) )
1359+ GenericBound :: Trait ( ty) => {
1360+ let trait_ref = this. lower_poly_trait_ref ( ty, itctx) ;
1361+ Some ( trait_ref)
13641362 }
13651363 GenericBound :: Outlives ( lifetime) => {
13661364 if lifetime_bound. is_none ( ) {
@@ -1993,21 +1991,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
19931991 span_ext : DUMMY_SP ,
19941992 } ) ;
19951993
1996- hir:: GenericBound :: Trait (
1997- hir:: PolyTraitRef {
1998- bound_generic_params : & [ ] ,
1999- trait_ref : hir:: TraitRef {
2000- path : self . make_lang_item_path (
2001- trait_lang_item,
2002- opaque_ty_span,
2003- Some ( bound_args) ,
2004- ) ,
2005- hir_ref_id : self . next_id ( ) ,
2006- } ,
2007- span : opaque_ty_span,
1994+ hir:: GenericBound :: Trait ( hir:: PolyTraitRef {
1995+ bound_generic_params : & [ ] ,
1996+ modifiers : hir:: TraitBoundModifier :: None ,
1997+ trait_ref : hir:: TraitRef {
1998+ path : self . make_lang_item_path ( trait_lang_item, opaque_ty_span, Some ( bound_args) ) ,
1999+ hir_ref_id : self . next_id ( ) ,
20082000 } ,
2009- hir :: TraitBoundModifier :: None ,
2010- )
2001+ span : opaque_ty_span ,
2002+ } )
20112003 }
20122004
20132005 #[ instrument( level = "trace" , skip( self ) ) ]
@@ -2017,10 +2009,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20172009 itctx : ImplTraitContext ,
20182010 ) -> hir:: GenericBound < ' hir > {
20192011 match tpb {
2020- GenericBound :: Trait ( p, modifiers) => hir:: GenericBound :: Trait (
2021- self . lower_poly_trait_ref ( p, itctx, * modifiers) ,
2022- self . lower_trait_bound_modifiers ( * modifiers) ,
2023- ) ,
2012+ GenericBound :: Trait ( p) => hir:: GenericBound :: Trait ( self . lower_poly_trait_ref ( p, itctx) ) ,
20242013 GenericBound :: Outlives ( lifetime) => {
20252014 hir:: GenericBound :: Outlives ( self . lower_lifetime ( lifetime) )
20262015 }
@@ -2224,12 +2213,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22242213 & mut self ,
22252214 p : & PolyTraitRef ,
22262215 itctx : ImplTraitContext ,
2227- modifiers : ast:: TraitBoundModifiers ,
22282216 ) -> hir:: PolyTraitRef < ' hir > {
22292217 let bound_generic_params =
22302218 self . lower_lifetime_binder ( p. trait_ref . ref_id , & p. bound_generic_params ) ;
2231- let trait_ref = self . lower_trait_ref ( modifiers, & p. trait_ref , itctx) ;
2232- hir:: PolyTraitRef { bound_generic_params, trait_ref, span : self . lower_span ( p. span ) }
2219+ let trait_ref = self . lower_trait_ref ( p. modifiers , & p. trait_ref , itctx) ;
2220+ let modifiers = self . lower_trait_bound_modifiers ( p. modifiers ) ;
2221+ hir:: PolyTraitRef {
2222+ bound_generic_params,
2223+ modifiers,
2224+ trait_ref,
2225+ span : self . lower_span ( p. span ) ,
2226+ }
22332227 }
22342228
22352229 fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext ) -> hir:: MutTy < ' hir > {
@@ -2669,10 +2663,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
26692663 Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , _) => {
26702664 let principal = hir:: PolyTraitRef {
26712665 bound_generic_params : & [ ] ,
2666+ modifiers : hir:: TraitBoundModifier :: None ,
26722667 trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
26732668 span : self . lower_span ( span) ,
26742669 } ;
2675- let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
26762670
26772671 // The original ID is taken by the `PolyTraitRef`,
26782672 // so the `Ty` itself needs a different one.
0 commit comments