@@ -1216,6 +1216,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12161216 itctx,
12171217 TraitBoundModifiers :: NONE ,
12181218 ) ;
1219+ let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
12191220 let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
12201221 let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
12211222 ( bounds, lifetime_bound)
@@ -1348,21 +1349,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13481349 // We can safely ignore constness here since AST validation
13491350 // takes care of rejecting invalid modifier combinations and
13501351 // 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+ }
13661363 GenericBound :: Outlives ( lifetime) => {
13671364 if lifetime_bound. is_none ( ) {
13681365 lifetime_bound = Some ( this. lower_lifetime ( lifetime) ) ;
@@ -2688,6 +2685,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
26882685 trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
26892686 span : self . lower_span ( span) ,
26902687 } ;
2688+ let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
26912689
26922690 // The original ID is taken by the `PolyTraitRef`,
26932691 // so the `Ty` itself needs a different one.
0 commit comments