@@ -1224,13 +1224,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1224
1224
let bound = this. lower_poly_trait_ref (
1225
1225
& PolyTraitRef {
1226
1226
bound_generic_params : ThinVec :: new ( ) ,
1227
+ modifiers : TraitBoundModifiers :: NONE ,
1227
1228
trait_ref : TraitRef { path : path. clone ( ) , ref_id : t. id } ,
1228
1229
span : t. span ,
1229
1230
} ,
1230
1231
itctx,
1231
- TraitBoundModifiers :: NONE ,
1232
1232
) ;
1233
- let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
1234
1233
let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
1235
1234
let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
1236
1235
( bounds, lifetime_bound)
@@ -1357,10 +1356,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1357
1356
// We can safely ignore constness here since AST validation
1358
1357
// takes care of rejecting invalid modifier combinations and
1359
1358
// 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)
1364
1362
}
1365
1363
GenericBound :: Outlives ( lifetime) => {
1366
1364
if lifetime_bound. is_none ( ) {
@@ -1993,21 +1991,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1993
1991
span_ext : DUMMY_SP ,
1994
1992
} ) ;
1995
1993
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 ( ) ,
2008
2000
} ,
2009
- hir :: TraitBoundModifier :: None ,
2010
- )
2001
+ span : opaque_ty_span ,
2002
+ } )
2011
2003
}
2012
2004
2013
2005
#[ instrument( level = "trace" , skip( self ) ) ]
@@ -2017,10 +2009,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2017
2009
itctx : ImplTraitContext ,
2018
2010
) -> hir:: GenericBound < ' hir > {
2019
2011
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) ) ,
2024
2013
GenericBound :: Outlives ( lifetime) => {
2025
2014
hir:: GenericBound :: Outlives ( self . lower_lifetime ( lifetime) )
2026
2015
}
@@ -2224,12 +2213,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2224
2213
& mut self ,
2225
2214
p : & PolyTraitRef ,
2226
2215
itctx : ImplTraitContext ,
2227
- modifiers : ast:: TraitBoundModifiers ,
2228
2216
) -> hir:: PolyTraitRef < ' hir > {
2229
2217
let bound_generic_params =
2230
2218
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
+ }
2233
2227
}
2234
2228
2235
2229
fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext ) -> hir:: MutTy < ' hir > {
@@ -2669,10 +2663,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2669
2663
Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , _) => {
2670
2664
let principal = hir:: PolyTraitRef {
2671
2665
bound_generic_params : & [ ] ,
2666
+ modifiers : hir:: TraitBoundModifier :: None ,
2672
2667
trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
2673
2668
span : self . lower_span ( span) ,
2674
2669
} ;
2675
- let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
2676
2670
2677
2671
// The original ID is taken by the `PolyTraitRef`,
2678
2672
// so the `Ty` itself needs a different one.
0 commit comments