@@ -1255,6 +1255,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12551255 itctx,
12561256 TraitBoundModifiers :: NONE ,
12571257 ) ;
1258+ let bound = ( bound, hir:: TraitBoundModifier :: None ) ;
12581259 let bounds = this. arena . alloc_from_iter ( [ bound] ) ;
12591260 let lifetime_bound = this. elided_dyn_bound ( t. span ) ;
12601261 ( bounds, lifetime_bound)
@@ -1386,21 +1387,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13861387 // We can safely ignore constness here since AST validation
13871388 // takes care of rejecting invalid modifier combinations and
13881389 // 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+ }
14041401 GenericBound :: Outlives ( lifetime) => {
14051402 if lifetime_bound. is_none ( ) {
14061403 lifetime_bound = Some ( this. lower_lifetime ( lifetime) ) ;
@@ -2502,6 +2499,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
25022499 trait_ref : hir:: TraitRef { path, hir_ref_id : hir_id } ,
25032500 span : self . lower_span ( span) ,
25042501 } ;
2502+ let principal = ( principal, hir:: TraitBoundModifier :: None ) ;
25052503
25062504 // The original ID is taken by the `PolyTraitRef`,
25072505 // so the `Ty` itself needs a different one.
0 commit comments