@@ -1255,16 +1255,13 @@ fn compare_values<'a>(
1255
1255
}
1256
1256
1257
1257
fn insert_lllocals < ' a > ( mut bcx : & ' a Block < ' a > ,
1258
- bindings_map : & BindingsMap ,
1259
- cleanup_scope : cleanup:: ScopeId )
1258
+ bindings_map : & BindingsMap )
1260
1259
-> & ' a Block < ' a > {
1261
1260
/*!
1262
1261
* For each binding in `data.bindings_map`, adds an appropriate entry into
1263
- * the `fcx.lllocals` map, scheduling cleanup in `cleanup_scope`.
1262
+ * the `fcx.lllocals` map
1264
1263
*/
1265
1264
1266
- let fcx = bcx. fcx ;
1267
-
1268
1265
for ( & ident, & binding_info) in bindings_map. iter ( ) {
1269
1266
let llval = match binding_info. trmode {
1270
1267
// By value mut binding for a copy type: load from the ptr
@@ -1285,7 +1282,6 @@ fn insert_lllocals<'a>(mut bcx: &'a Block<'a>,
1285
1282
} ;
1286
1283
1287
1284
let datum = Datum :: new ( llval, binding_info. ty , Lvalue ) ;
1288
- fcx. schedule_drop_mem ( cleanup_scope, llval, binding_info. ty ) ;
1289
1285
1290
1286
debug ! ( "binding {:?} to {}" ,
1291
1287
binding_info. id,
@@ -1317,21 +1313,11 @@ fn compile_guard<'a, 'b>(
1317
1313
vec_map_to_str( vals, |v| bcx. val_to_str( * v) ) ) ;
1318
1314
let _indenter = indenter ( ) ;
1319
1315
1320
- // Lest the guard itself should fail, introduce a temporary cleanup
1321
- // scope for any non-ref bindings we create.
1322
- let temp_scope = bcx. fcx . push_custom_cleanup_scope ( ) ;
1323
-
1324
- let mut bcx = insert_lllocals ( bcx, & data. bindings_map ,
1325
- cleanup:: CustomScope ( temp_scope) ) ;
1316
+ let mut bcx = insert_lllocals ( bcx, & data. bindings_map ) ;
1326
1317
1327
1318
let val = unpack_datum ! ( bcx, expr:: trans( bcx, guard_expr) ) ;
1328
1319
let val = val. to_llbool ( bcx) ;
1329
1320
1330
- // Cancel cleanups now that the guard successfully executed. If
1331
- // the guard was false, we will drop the values explicitly
1332
- // below. Otherwise, we'll add lvalue cleanups at the end.
1333
- bcx. fcx . pop_custom_cleanup_scope ( temp_scope) ;
1334
-
1335
1321
return with_cond ( bcx, Not ( bcx, val) , |bcx| {
1336
1322
// Guard does not match: remove all bindings from the lllocals table
1337
1323
for ( _, & binding_info) in data. bindings_map . iter ( ) {
@@ -1884,12 +1870,9 @@ fn trans_match_inner<'a>(scope_cx: &'a Block<'a>,
1884
1870
for arm_data in arm_datas. iter ( ) {
1885
1871
let mut bcx = arm_data. bodycx ;
1886
1872
1887
- // insert bindings into the lllocals map and add cleanups
1888
- let cleanup_scope = fcx. push_custom_cleanup_scope ( ) ;
1889
- bcx = insert_lllocals ( bcx, & arm_data. bindings_map ,
1890
- cleanup:: CustomScope ( cleanup_scope) ) ;
1873
+ // insert bindings into the lllocals map
1874
+ bcx = insert_lllocals ( bcx, & arm_data. bindings_map ) ;
1891
1875
bcx = expr:: trans_into ( bcx, & * arm_data. arm . body , dest) ;
1892
- bcx = fcx. pop_and_trans_custom_cleanup_scope ( bcx, cleanup_scope) ;
1893
1876
arm_cxs. push ( bcx) ;
1894
1877
}
1895
1878
0 commit comments