@@ -1210,41 +1210,9 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1210
1210
1211
1211
self . prove_aggregate_predicates ( aggregate_kind, location) ;
1212
1212
1213
- match aggregate_kind {
1213
+ if * aggregate_kind == AggregateKind :: Tuple {
1214
1214
// tuple rvalue field type is always the type of the op. Nothing to check here.
1215
- AggregateKind :: Tuple => return ,
1216
-
1217
- // For closures, we have some **extra requirements** we
1218
- // have to check. In particular, in their upvars and
1219
- // signatures, closures often reference various regions
1220
- // from the surrounding function -- we call those the
1221
- // closure's free regions. When we borrow-check (and hence
1222
- // region-check) closures, we may find that the closure
1223
- // requires certain relationships between those free
1224
- // regions. However, because those free regions refer to
1225
- // portions of the CFG of their caller, the closure is not
1226
- // in a position to verify those relationships. In that
1227
- // case, the requirements get "propagated" to us, and so
1228
- // we have to solve them here where we instantiate the
1229
- // closure.
1230
- //
1231
- // Despite the opacity of the previous parapgrah, this is
1232
- // actually relatively easy to understand in terms of the
1233
- // desugaring. A closure gets desugared to a struct, and
1234
- // these extra requirements are basically like where
1235
- // clauses on the struct.
1236
- AggregateKind :: Closure ( def_id, substs) => {
1237
- if let Some ( closure_region_requirements) = tcx. mir_borrowck ( * def_id) {
1238
- closure_region_requirements. apply_requirements (
1239
- self . infcx ,
1240
- location,
1241
- * def_id,
1242
- * substs,
1243
- ) ;
1244
- }
1245
- }
1246
-
1247
- _ => { }
1215
+ return ;
1248
1216
}
1249
1217
1250
1218
for ( i, operand) in operands. iter ( ) . enumerate ( ) {
@@ -1295,7 +1263,39 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1295
1263
tcx. predicates_of ( def. did ) . instantiate ( tcx, substs)
1296
1264
}
1297
1265
1298
- AggregateKind :: Closure ( def_id, substs) |
1266
+ // For closures, we have some **extra requirements** we
1267
+ //
1268
+ // have to check. In particular, in their upvars and
1269
+ // signatures, closures often reference various regions
1270
+ // from the surrounding function -- we call those the
1271
+ // closure's free regions. When we borrow-check (and hence
1272
+ // region-check) closures, we may find that the closure
1273
+ // requires certain relationships between those free
1274
+ // regions. However, because those free regions refer to
1275
+ // portions of the CFG of their caller, the closure is not
1276
+ // in a position to verify those relationships. In that
1277
+ // case, the requirements get "propagated" to us, and so
1278
+ // we have to solve them here where we instantiate the
1279
+ // closure.
1280
+ //
1281
+ // Despite the opacity of the previous parapgrah, this is
1282
+ // actually relatively easy to understand in terms of the
1283
+ // desugaring. A closure gets desugared to a struct, and
1284
+ // these extra requirements are basically like where
1285
+ // clauses on the struct.
1286
+ AggregateKind :: Closure ( def_id, substs) => {
1287
+ if let Some ( closure_region_requirements) = tcx. mir_borrowck ( * def_id) {
1288
+ closure_region_requirements. apply_requirements (
1289
+ self . infcx ,
1290
+ location,
1291
+ * def_id,
1292
+ * substs,
1293
+ ) ;
1294
+ }
1295
+
1296
+ tcx. predicates_of ( * def_id) . instantiate ( tcx, substs. substs )
1297
+ }
1298
+
1299
1299
AggregateKind :: Generator ( def_id, substs, _) => {
1300
1300
tcx. predicates_of ( * def_id) . instantiate ( tcx, substs. substs )
1301
1301
}
0 commit comments