@@ -1219,13 +1219,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1219
1219
let bound = this. lower_poly_trait_ref (
1220
1220
& PolyTraitRef {
1221
1221
bound_generic_params : ThinVec :: new ( ) ,
1222
+ modifiers : TraitBoundModifiers :: NONE ,
1222
1223
trait_ref : TraitRef { path : path. clone ( ) , ref_id : t. id } ,
1223
1224
span : t. span ,
1224
1225
} ,
1225
1226
itctx,
1226
- TraitBoundModifiers :: NONE ,
1227
1227
) ;
1228
- let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
1229
1228
let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
1230
1229
let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
1231
1230
( bounds, lifetime_bound)
@@ -1326,10 +1325,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1326
1325
// We can safely ignore constness here since AST validation
1327
1326
// takes care of rejecting invalid modifier combinations and
1328
1327
// const trait bounds in trait object types.
1329
- GenericBound :: Trait ( ty, modifiers) => {
1330
- let trait_ref = this. lower_poly_trait_ref ( ty, itctx, * modifiers) ;
1331
- let polarity = this. lower_trait_bound_modifiers ( * modifiers) ;
1332
- Some ( ( trait_ref, polarity) )
1328
+ GenericBound :: Trait ( ty) => {
1329
+ let trait_ref = this. lower_poly_trait_ref ( ty, itctx) ;
1330
+ Some ( trait_ref)
1333
1331
}
1334
1332
GenericBound :: Outlives ( lifetime) => {
1335
1333
if lifetime_bound. is_none ( ) {
@@ -1958,21 +1956,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1958
1956
span_ext : DUMMY_SP ,
1959
1957
} ) ;
1960
1958
1961
- hir:: GenericBound :: Trait (
1962
- hir:: PolyTraitRef {
1963
- bound_generic_params : & [ ] ,
1964
- trait_ref : hir:: TraitRef {
1965
- path : self . make_lang_item_path (
1966
- trait_lang_item,
1967
- opaque_ty_span,
1968
- Some ( bound_args) ,
1969
- ) ,
1970
- hir_ref_id : self . next_id ( ) ,
1971
- } ,
1972
- span : opaque_ty_span,
1959
+ hir:: GenericBound :: Trait ( hir:: PolyTraitRef {
1960
+ bound_generic_params : & [ ] ,
1961
+ modifiers : hir:: TraitBoundModifier :: None ,
1962
+ trait_ref : hir:: TraitRef {
1963
+ path : self . make_lang_item_path ( trait_lang_item, opaque_ty_span, Some ( bound_args) ) ,
1964
+ hir_ref_id : self . next_id ( ) ,
1973
1965
} ,
1974
- hir :: TraitBoundModifier :: None ,
1975
- )
1966
+ span : opaque_ty_span ,
1967
+ } )
1976
1968
}
1977
1969
1978
1970
#[ instrument( level = "trace" , skip( self ) ) ]
@@ -1982,10 +1974,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1982
1974
itctx : ImplTraitContext ,
1983
1975
) -> hir:: GenericBound < ' hir > {
1984
1976
match tpb {
1985
- GenericBound :: Trait ( p, modifiers) => hir:: GenericBound :: Trait (
1986
- self . lower_poly_trait_ref ( p, itctx, * modifiers) ,
1987
- self . lower_trait_bound_modifiers ( * modifiers) ,
1988
- ) ,
1977
+ GenericBound :: Trait ( p) => hir:: GenericBound :: Trait ( self . lower_poly_trait_ref ( p, itctx) ) ,
1989
1978
GenericBound :: Outlives ( lifetime) => {
1990
1979
hir:: GenericBound :: Outlives ( self . lower_lifetime ( lifetime) )
1991
1980
}
@@ -2189,12 +2178,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2189
2178
& mut self ,
2190
2179
p : & PolyTraitRef ,
2191
2180
itctx : ImplTraitContext ,
2192
- modifiers : ast:: TraitBoundModifiers ,
2193
2181
) -> hir:: PolyTraitRef < ' hir > {
2194
2182
let bound_generic_params =
2195
2183
self . lower_lifetime_binder ( p. trait_ref . ref_id , & p. bound_generic_params ) ;
2196
- let trait_ref = self . lower_trait_ref ( modifiers, & p. trait_ref , itctx) ;
2197
- hir:: PolyTraitRef { bound_generic_params, trait_ref, span : self . lower_span ( p. span ) }
2184
+ let trait_ref = self . lower_trait_ref ( p. modifiers , & p. trait_ref , itctx) ;
2185
+ let modifiers = self . lower_trait_bound_modifiers ( p. modifiers ) ;
2186
+ hir:: PolyTraitRef {
2187
+ bound_generic_params,
2188
+ modifiers,
2189
+ trait_ref,
2190
+ span : self . lower_span ( p. span ) ,
2191
+ }
2198
2192
}
2199
2193
2200
2194
fn lower_mt ( & mut self , mt : & MutTy , itctx : ImplTraitContext ) -> hir:: MutTy < ' hir > {
@@ -2634,10 +2628,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2634
2628
Res :: Def ( DefKind :: Trait | DefKind :: TraitAlias , _) => {
2635
2629
let principal = hir:: PolyTraitRef {
2636
2630
bound_generic_params : & [ ] ,
2631
+ modifiers : hir:: TraitBoundModifier :: None ,
2637
2632
trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
2638
2633
span : self . lower_span ( span) ,
2639
2634
} ;
2640
- let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
2641
2635
2642
2636
// The original ID is taken by the `PolyTraitRef`,
2643
2637
// so the `Ty` itself needs a different one.
0 commit comments