@@ -1216,6 +1216,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1216
1216
itctx,
1217
1217
TraitBoundModifiers :: NONE ,
1218
1218
) ;
1219
+ let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
1219
1220
let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
1220
1221
let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
1221
1222
( bounds, lifetime_bound)
@@ -1348,21 +1349,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1348
1349
// We can safely ignore constness here since AST validation
1349
1350
// takes care of rejecting invalid modifier combinations and
1350
1351
// const trait bounds in trait object types.
1351
- GenericBound :: Trait ( ty, modifiers) => match modifiers. polarity {
1352
- BoundPolarity :: Positive | BoundPolarity :: Negative ( _) => {
1353
- Some ( this. lower_poly_trait_ref (
1354
- ty,
1355
- itctx,
1356
- // Still, don't pass along the constness here; we don't want to
1357
- // synthesize any host effect args, it'd only cause problems.
1358
- TraitBoundModifiers {
1359
- constness : BoundConstness :: Never ,
1360
- ..* modifiers
1361
- } ,
1362
- ) )
1363
- }
1364
- BoundPolarity :: Maybe ( _) => None ,
1365
- } ,
1352
+ GenericBound :: Trait ( ty, modifiers) => {
1353
+ // Still, don't pass along the constness here; we don't want to
1354
+ // synthesize any host effect args, it'd only cause problems.
1355
+ let modifiers = TraitBoundModifiers {
1356
+ constness : BoundConstness :: Never ,
1357
+ ..* modifiers
1358
+ } ;
1359
+ let trait_ref = this. lower_poly_trait_ref ( ty, itctx, modifiers) ;
1360
+ let polarity = this. lower_trait_bound_modifiers ( modifiers) ;
1361
+ Some ( ( trait_ref, polarity) )
1362
+ }
1366
1363
GenericBound :: Outlives ( lifetime) => {
1367
1364
if lifetime_bound. is_none ( ) {
1368
1365
lifetime_bound = Some ( this. lower_lifetime ( lifetime) ) ;
@@ -2688,6 +2685,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2688
2685
trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
2689
2686
span : self . lower_span ( span) ,
2690
2687
} ;
2688
+ let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
2691
2689
2692
2690
// The original ID is taken by the `PolyTraitRef`,
2693
2691
// so the `Ty` itself needs a different one.
0 commit comments