@@ -1400,7 +1400,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14001400        // keep track of the Span info. Now, `<dyn HirTyLowerer>::add_implicit_sized_bound` 
14011401        // checks both param bounds and where clauses for `?Sized`. 
14021402        for  pred in  & generics. where_clause . predicates  { 
1403-             let  WherePredicate :: BoundPredicate ( bound_pred)  = pred else  { 
1403+             let  WherePredicateKind :: BoundPredicate ( ref   bound_pred)  = pred. kind  else  { 
14041404                continue ; 
14051405            } ; 
14061406            let  compute_is_param = || { 
@@ -1538,8 +1538,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
15381538        } ) ; 
15391539        let  span = self . lower_span ( span) ; 
15401540
1541-         match  kind { 
1542-             GenericParamKind :: Const  {  .. }  => None , 
1541+         let  kind =  match  kind { 
1542+             GenericParamKind :: Const  {  .. }  => return   None , 
15431543            GenericParamKind :: Type  {  .. }  => { 
15441544                let  def_id = self . local_def_id ( id) . to_def_id ( ) ; 
15451545                let  hir_id = self . next_id ( ) ; 
@@ -1554,37 +1554,40 @@ impl<'hir> LoweringContext<'_, 'hir> {
15541554                let  ty_id = self . next_id ( ) ; 
15551555                let  bounded_ty =
15561556                    self . ty_path ( ty_id,  param_span,  hir:: QPath :: Resolved ( None ,  ty_path) ) ; 
1557-                 Some ( hir:: WherePredicate :: BoundPredicate ( hir:: WhereBoundPredicate  { 
1557+                 hir:: WherePredicateKind :: BoundPredicate ( hir:: WhereBoundPredicate  { 
15581558                    hir_id :  self . next_id ( ) , 
15591559                    bounded_ty :  self . arena . alloc ( bounded_ty) , 
15601560                    bounds, 
15611561                    span, 
15621562                    bound_generic_params :  & [ ] , 
15631563                    origin, 
1564-                 } ) ) 
1564+                 } ) 
15651565            } 
15661566            GenericParamKind :: Lifetime  => { 
15671567                let  ident = self . lower_ident ( ident) ; 
15681568                let  lt_id = self . next_node_id ( ) ; 
15691569                let  lifetime = self . new_named_lifetime ( id,  lt_id,  ident) ; 
1570-                 Some ( hir:: WherePredicate :: RegionPredicate ( hir:: WhereRegionPredicate  { 
1570+                 hir:: WherePredicateKind :: RegionPredicate ( hir:: WhereRegionPredicate  { 
15711571                    lifetime, 
15721572                    span, 
15731573                    bounds, 
15741574                    in_where_clause :  false , 
1575-                 } ) ) 
1575+                 } ) 
15761576            } 
1577-         } 
1577+         } ; 
1578+         Some ( hir:: WherePredicate  {  hir_id :  self . next_id ( ) ,  kind :  self . arena . alloc ( kind)  } ) 
15781579    } 
15791580
15801581    fn  lower_where_predicate ( & mut  self ,  pred :  & WherePredicate )  -> hir:: WherePredicate < ' hir >  { 
1581-         match  pred { 
1582-             WherePredicate :: BoundPredicate ( WhereBoundPredicate  { 
1582+         let  hir_id = self . lower_node_id ( pred. id ) ; 
1583+         self . lower_attrs ( hir_id,  & pred. attrs ) ; 
1584+         let  kind = match  & pred. kind  { 
1585+             WherePredicateKind :: BoundPredicate ( WhereBoundPredicate  { 
15831586                bound_generic_params, 
15841587                bounded_ty, 
15851588                bounds, 
15861589                span, 
1587-             } )  => hir:: WherePredicate :: BoundPredicate ( hir:: WhereBoundPredicate  { 
1590+             } )  => hir:: WherePredicateKind :: BoundPredicate ( hir:: WhereBoundPredicate  { 
15881591                hir_id :  self . next_id ( ) , 
15891592                bound_generic_params :  self 
15901593                    . lower_generic_params ( bound_generic_params,  hir:: GenericParamSource :: Binder ) , 
@@ -1597,26 +1600,30 @@ impl<'hir> LoweringContext<'_, 'hir> {
15971600                span :  self . lower_span ( * span) , 
15981601                origin :  PredicateOrigin :: WhereClause , 
15991602            } ) , 
1600-             WherePredicate :: RegionPredicate ( WhereRegionPredicate  {  lifetime,  bounds,  span } )  => { 
1601-                 hir:: WherePredicate :: RegionPredicate ( hir:: WhereRegionPredicate  { 
1602-                     span :  self . lower_span ( * span) , 
1603-                     lifetime :  self . lower_lifetime ( lifetime) , 
1604-                     bounds :  self . lower_param_bounds ( 
1605-                         bounds, 
1606-                         ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) , 
1607-                     ) , 
1608-                     in_where_clause :  true , 
1609-                 } ) 
1610-             } 
1611-             WherePredicate :: EqPredicate ( WhereEqPredicate  {  lhs_ty,  rhs_ty,  span } )  => { 
1612-                 hir:: WherePredicate :: EqPredicate ( hir:: WhereEqPredicate  { 
1603+             WherePredicateKind :: RegionPredicate ( WhereRegionPredicate  { 
1604+                 lifetime, 
1605+                 bounds, 
1606+                 span, 
1607+             } )  => hir:: WherePredicateKind :: RegionPredicate ( hir:: WhereRegionPredicate  { 
1608+                 span :  self . lower_span ( * span) , 
1609+                 lifetime :  self . lower_lifetime ( lifetime) , 
1610+                 bounds :  self . lower_param_bounds ( 
1611+                     bounds, 
1612+                     ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) , 
1613+                 ) , 
1614+                 in_where_clause :  true , 
1615+             } ) , 
1616+             WherePredicateKind :: EqPredicate ( WhereEqPredicate  {  lhs_ty,  rhs_ty,  span } )  => { 
1617+                 hir:: WherePredicateKind :: EqPredicate ( hir:: WhereEqPredicate  { 
16131618                    lhs_ty :  self 
16141619                        . lower_ty ( lhs_ty,  ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ) , 
16151620                    rhs_ty :  self 
16161621                        . lower_ty ( rhs_ty,  ImplTraitContext :: Disallowed ( ImplTraitPosition :: Bound ) ) , 
16171622                    span :  self . lower_span ( * span) , 
16181623                } ) 
16191624            } 
1620-         } 
1625+         } ; 
1626+         let  kind = self . arena . alloc ( kind) ; 
1627+         hir:: WherePredicate  {  hir_id,  kind } 
16211628    } 
16221629} 
0 commit comments