@@ -1023,8 +1023,8 @@ pub struct Predicate<'tcx> {
1023
1023
}
1024
1024
1025
1025
impl Predicate < ' tcx > {
1026
- pub fn kind ( & self ) -> PredicateKind < ' tcx > {
1027
- * self . kind
1026
+ pub fn kind ( & self ) -> & ' tcx PredicateKind < ' tcx > {
1027
+ self . kind
1028
1028
}
1029
1029
}
1030
1030
@@ -1163,35 +1163,36 @@ impl<'tcx> Predicate<'tcx> {
1163
1163
// this trick achieves that).
1164
1164
1165
1165
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) => {
1168
1168
PredicateKind :: Trait ( binder. map_bound ( |data| data. subst ( tcx, substs) ) , constness)
1169
1169
}
1170
- PredicateKind :: Subtype ( ref binder) => {
1170
+ PredicateKind :: Subtype ( binder) => {
1171
1171
PredicateKind :: Subtype ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
1172
1172
}
1173
- PredicateKind :: RegionOutlives ( ref binder) => {
1173
+ PredicateKind :: RegionOutlives ( binder) => {
1174
1174
PredicateKind :: RegionOutlives ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
1175
1175
}
1176
- PredicateKind :: TypeOutlives ( ref binder) => {
1176
+ PredicateKind :: TypeOutlives ( binder) => {
1177
1177
PredicateKind :: TypeOutlives ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
1178
1178
}
1179
- PredicateKind :: Projection ( ref binder) => {
1179
+ PredicateKind :: Projection ( binder) => {
1180
1180
PredicateKind :: Projection ( binder. map_bound ( |data| data. subst ( tcx, substs) ) )
1181
1181
}
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) => {
1185
1185
PredicateKind :: ClosureKind ( closure_def_id, closure_substs. subst ( tcx, substs) , kind)
1186
1186
}
1187
- PredicateKind :: ConstEvaluatable ( def_id, const_substs) => {
1187
+ & PredicateKind :: ConstEvaluatable ( def_id, const_substs) => {
1188
1188
PredicateKind :: ConstEvaluatable ( def_id, const_substs. subst ( tcx, substs) )
1189
1189
}
1190
1190
PredicateKind :: ConstEquate ( c1, c2) => {
1191
1191
PredicateKind :: ConstEquate ( c1. subst ( tcx, substs) , c2. subst ( tcx, substs) )
1192
1192
}
1193
- }
1194
- . to_predicate ( tcx)
1193
+ } ;
1194
+
1195
+ predicate. to_predicate ( tcx)
1195
1196
}
1196
1197
}
1197
1198
@@ -1370,7 +1371,7 @@ impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
1370
1371
impl < ' tcx > Predicate < ' tcx > {
1371
1372
pub fn to_opt_poly_trait_ref ( & self ) -> Option < PolyTraitRef < ' tcx > > {
1372
1373
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 ( ) ) ,
1374
1375
PredicateKind :: Projection ( ..)
1375
1376
| PredicateKind :: Subtype ( ..)
1376
1377
| PredicateKind :: RegionOutlives ( ..)
@@ -1385,7 +1386,7 @@ impl<'tcx> Predicate<'tcx> {
1385
1386
1386
1387
pub fn to_opt_type_outlives ( & self ) -> Option < PolyTypeOutlivesPredicate < ' tcx > > {
1387
1388
match self . kind ( ) {
1388
- PredicateKind :: TypeOutlives ( data) => Some ( data) ,
1389
+ & PredicateKind :: TypeOutlives ( data) => Some ( data) ,
1389
1390
PredicateKind :: Trait ( ..)
1390
1391
| PredicateKind :: Projection ( ..)
1391
1392
| PredicateKind :: Subtype ( ..)
0 commit comments