@@ -1255,6 +1255,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1255
1255
itctx,
1256
1256
TraitBoundModifiers :: NONE ,
1257
1257
) ;
1258
+ let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
1258
1259
let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
1259
1260
let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
1260
1261
( bounds, lifetime_bound)
@@ -1386,21 +1387,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1386
1387
// We can safely ignore constness here since AST validation
1387
1388
// takes care of rejecting invalid modifier combinations and
1388
1389
// const trait bounds in trait object types.
1389
- GenericBound :: Trait ( ty, modifiers) => match modifiers. polarity {
1390
- BoundPolarity :: Positive | BoundPolarity :: Negative ( _) => {
1391
- Some ( this. lower_poly_trait_ref (
1392
- ty,
1393
- itctx,
1394
- // Still, don't pass along the constness here; we don't want to
1395
- // synthesize any host effect args, it'd only cause problems.
1396
- TraitBoundModifiers {
1397
- constness : BoundConstness :: Never ,
1398
- ..* modifiers
1399
- } ,
1400
- ) )
1401
- }
1402
- BoundPolarity :: Maybe ( _) => None ,
1403
- } ,
1390
+ GenericBound :: Trait ( ty, modifiers) => {
1391
+ // Still, don't pass along the constness here; we don't want to
1392
+ // synthesize any host effect args, it'd only cause problems.
1393
+ let modifiers = TraitBoundModifiers {
1394
+ constness : BoundConstness :: Never ,
1395
+ ..* modifiers
1396
+ } ;
1397
+ let trait_ref = this. lower_poly_trait_ref ( ty, itctx, modifiers) ;
1398
+ let polarity = this. lower_trait_bound_modifiers ( modifiers) ;
1399
+ Some ( ( trait_ref, polarity) )
1400
+ }
1404
1401
GenericBound :: Outlives ( lifetime) => {
1405
1402
if lifetime_bound. is_none ( ) {
1406
1403
lifetime_bound = Some ( this. lower_lifetime ( lifetime) ) ;
@@ -2502,6 +2499,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2502
2499
trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
2503
2500
span : self . lower_span ( span) ,
2504
2501
} ;
2502
+ let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
2505
2503
2506
2504
// The original ID is taken by the `PolyTraitRef`,
2507
2505
// so the `Ty` itself needs a different one.
0 commit comments