@@ -1023,8 +1023,8 @@ pub struct Predicate<'tcx> {
10231023}
10241024
10251025impl Predicate < ' tcx > {
1026- pub fn kind ( & self ) -> PredicateKind < ' tcx > {
1027- * self . kind
1026+ pub fn kind ( & self ) -> & ' tcx PredicateKind < ' tcx > {
1027+ self . kind
10281028 }
10291029}
10301030
@@ -1163,35 +1163,36 @@ impl<'tcx> Predicate<'tcx> {
11631163 // this trick achieves that).
11641164
11651165 let substs = & trait_ref. skip_binder ( ) . substs ;
1166- match self . kind ( ) {
1167- PredicateKind :: Trait ( ref binder, constness) => {
1166+ let predicate = match self . kind ( ) {
1167+ & PredicateKind :: Trait ( ref binder, constness) => {
11681168 PredicateKind :: Trait ( binder. map_bound ( |data| data. subst ( tcx, substs) ) , constness)
11691169 }
1170- PredicateKind :: Subtype ( ref binder) => {
1170+ PredicateKind :: Subtype ( binder) => {
11711171 PredicateKind :: Subtype ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
11721172 }
1173- PredicateKind :: RegionOutlives ( ref binder) => {
1173+ PredicateKind :: RegionOutlives ( binder) => {
11741174 PredicateKind :: RegionOutlives ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
11751175 }
1176- PredicateKind :: TypeOutlives ( ref binder) => {
1176+ PredicateKind :: TypeOutlives ( binder) => {
11771177 PredicateKind :: TypeOutlives ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
11781178 }
1179- PredicateKind :: Projection ( ref binder) => {
1179+ PredicateKind :: Projection ( binder) => {
11801180 PredicateKind :: Projection ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
11811181 }
1182- PredicateKind :: WellFormed ( data) => PredicateKind :: WellFormed ( data. subst ( tcx, substs) ) ,
1183- PredicateKind :: ObjectSafe ( trait_def_id) => PredicateKind :: ObjectSafe ( trait_def_id) ,
1184- PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) => {
1182+ & PredicateKind :: WellFormed ( data) => PredicateKind :: WellFormed ( data. subst ( tcx, substs) ) ,
1183+ & PredicateKind :: ObjectSafe ( trait_def_id) => PredicateKind :: ObjectSafe ( trait_def_id) ,
1184+ & PredicateKind :: ClosureKind ( closure_def_id, closure_substs, kind) => {
11851185 PredicateKind :: ClosureKind ( closure_def_id, closure_substs. subst ( tcx, substs) , kind)
11861186 }
1187- PredicateKind :: ConstEvaluatable ( def_id, const_substs) => {
1187+ & PredicateKind :: ConstEvaluatable ( def_id, const_substs) => {
11881188 PredicateKind :: ConstEvaluatable ( def_id, const_substs. subst ( tcx, substs) )
11891189 }
11901190 PredicateKind :: ConstEquate ( c1, c2) => {
11911191 PredicateKind :: ConstEquate ( c1. subst ( tcx, substs) , c2. subst ( tcx, substs) )
11921192 }
1193- }
1194- . to_predicate ( tcx)
1193+ } ;
1194+
1195+ predicate. to_predicate ( tcx)
11951196 }
11961197}
11971198
@@ -1370,7 +1371,7 @@ impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
13701371impl < ' tcx > Predicate < ' tcx > {
13711372 pub fn to_opt_poly_trait_ref ( & self ) -> Option < PolyTraitRef < ' tcx > > {
13721373 match self . kind ( ) {
1373- PredicateKind :: Trait ( ref t, _) => Some ( t. to_poly_trait_ref ( ) ) ,
1374+ & PredicateKind :: Trait ( ref t, _) => Some ( t. to_poly_trait_ref ( ) ) ,
13741375 PredicateKind :: Projection ( ..)
13751376 | PredicateKind :: Subtype ( ..)
13761377 | PredicateKind :: RegionOutlives ( ..)
@@ -1385,7 +1386,7 @@ impl<'tcx> Predicate<'tcx> {
13851386
13861387 pub fn to_opt_type_outlives ( & self ) -> Option < PolyTypeOutlivesPredicate < ' tcx > > {
13871388 match self . kind ( ) {
1388- PredicateKind :: TypeOutlives ( data) => Some ( data) ,
1389+ & PredicateKind :: TypeOutlives ( data) => Some ( data) ,
13891390 PredicateKind :: Trait ( ..)
13901391 | PredicateKind :: Projection ( ..)
13911392 | PredicateKind :: Subtype ( ..)
0 commit comments