@@ -866,8 +866,8 @@ pub fn need_invoke(bcx: block) -> bool {
866
866
// Walk the scopes to look for cleanups
867
867
let mut cur = bcx;
868
868
loop {
869
- match cur. kind {
870
- block_scope( ref inf) => {
869
+ match * cur. kind {
870
+ block_scope( ref mut inf) => {
871
871
for vec:: each( ( * inf) . cleanups) |cleanup| {
872
872
match * cleanup {
873
873
clean( _, cleanup_type) | clean_temp( _, _, cleanup_type) => {
@@ -898,16 +898,21 @@ pub fn have_cached_lpad(bcx: block) -> bool {
898
898
return res;
899
899
}
900
900
901
- pub fn in_lpad_scope_cx ( bcx : block , f : fn ( scope_info ) ) {
901
+ pub fn in_lpad_scope_cx ( bcx : block , f : fn ( & mut scope_info ) ) {
902
902
let mut bcx = bcx;
903
903
loop {
904
- match bcx. kind {
905
- block_scope( ref inf) => {
906
- if ( * inf) . cleanups . len ( ) > 0 u || bcx. parent . is_none ( ) {
907
- f ( ( * inf) ) ; return ;
904
+ {
905
+ // XXX: Borrow check bug workaround.
906
+ let kind: & mut block_kind = & mut * bcx. kind ;
907
+ match * kind {
908
+ block_scope( ref mut inf) => {
909
+ if inf. cleanups . len ( ) > 0 u || bcx. parent . is_none ( ) {
910
+ f ( inf) ;
911
+ return ;
912
+ }
913
+ }
914
+ _ => ( )
908
915
}
909
- }
910
- _ => ( )
911
916
}
912
917
bcx = block_parent ( bcx) ;
913
918
}
@@ -1157,7 +1162,7 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
1157
1162
}
1158
1163
}
1159
1164
}
1160
- ast:: decl_item( i) => trans_item ( cx. fcx . ccx , * i)
1165
+ ast:: decl_item( i) => trans_item ( * cx. fcx . ccx , * i)
1161
1166
}
1162
1167
}
1163
1168
ast:: stmt_mac( * ) => cx. tcx ( ) . sess . bug ( ~"unexpanded macro")
@@ -1198,9 +1203,9 @@ pub fn simple_block_scope() -> block_kind {
1198
1203
block_scope ( scope_info {
1199
1204
loop_break : None ,
1200
1205
loop_label : None ,
1201
- mut cleanups : ~[ ] ,
1202
- mut cleanup_paths : ~[ ] ,
1203
- mut landing_pad : None
1206
+ cleanups : ~[ ] ,
1207
+ cleanup_paths : ~[ ] ,
1208
+ landing_pad : None
1204
1209
} )
1205
1210
}
1206
1211
@@ -1226,9 +1231,9 @@ pub fn loop_scope_block(bcx: block,
1226
1231
return new_block ( bcx. fcx , Some ( bcx) , block_scope ( scope_info {
1227
1232
loop_break : Some ( loop_break) ,
1228
1233
loop_label : loop_label,
1229
- mut cleanups : ~[ ] ,
1230
- mut cleanup_paths : ~[ ] ,
1231
- mut landing_pad : None
1234
+ cleanups : ~[ ] ,
1235
+ cleanup_paths : ~[ ] ,
1236
+ landing_pad : None
1232
1237
} ) , bcx. is_lpad , n, opt_node_info) ;
1233
1238
}
1234
1239
@@ -1301,23 +1306,30 @@ pub fn cleanup_and_leave(bcx: block,
1301
1306
@fmt ! ( "cleanup_and_leave(%s)" , cur. to_str( ) ) ) ;
1302
1307
}
1303
1308
1304
- match cur. kind {
1305
- block_scope( ref inf) if !inf. cleanups . is_empty ( ) => {
1306
- for vec:: find( ( * inf) . cleanup_paths,
1307
- |cp| cp. target == leave) . each |cp| {
1308
- Br ( bcx, cp. dest) ;
1309
- return ;
1309
+ {
1310
+ // XXX: Borrow check bug workaround.
1311
+ let kind: & mut block_kind = & mut * cur. kind ;
1312
+ match * kind {
1313
+ block_scope( ref mut inf) if !inf. cleanups . is_empty ( ) => {
1314
+ for vec:: find( ( * inf) . cleanup_paths,
1315
+ |cp| cp. target == leave) . each |cp| {
1316
+ Br ( bcx, cp. dest) ;
1317
+ return ;
1318
+ }
1319
+ let sub_cx = sub_block( bcx, ~"cleanup") ;
1320
+ Br ( bcx, sub_cx. llbb) ;
1321
+ inf. cleanup_paths. push( cleanup_path {
1322
+ target : leave,
1323
+ dest : sub_cx. llbb
1324
+ } ) ;
1325
+ bcx = trans_block_cleanups_( sub_cx,
1326
+ block_cleanups( cur) ,
1327
+ is_lpad) ;
1328
+ }
1329
+ _ => ( )
1310
1330
}
1311
- let sub_cx = sub_block( bcx, ~"cleanup") ;
1312
- Br ( bcx, sub_cx. llbb) ;
1313
- ( * inf) . cleanup_paths. push( cleanup_path {
1314
- target : leave,
1315
- dest : sub_cx. llbb
1316
- } ) ;
1317
- bcx = trans_block_cleanups_( sub_cx, block_cleanups( cur) , is_lpad) ;
1318
- }
1319
- _ => ( )
1320
1331
}
1332
+
1321
1333
match upto {
1322
1334
Some ( bb) => { if cur. llbb == bb { break ; } }
1323
1335
_ => ( )
@@ -1572,25 +1584,25 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
1572
1584
param_substs: Option<@param_substs>,
1573
1585
sp: Option<span>) -> fn_ctxt {
1574
1586
let llbbs = mk_standard_basic_blocks(llfndecl);
1575
- return @fn_ctxt_ {
1587
+ return @mut fn_ctxt_ {
1576
1588
llfn: llfndecl,
1577
1589
llenv: unsafe { llvm::LLVMGetParam(llfndecl, 1u as c_uint) },
1578
1590
llretptr: unsafe { llvm::LLVMGetParam(llfndecl, 0u as c_uint) },
1579
- mut llstaticallocas: llbbs.sa,
1580
- mut llloadenv: None,
1581
- mut llreturn: llbbs.rt,
1582
- mut llself: None,
1583
- mut personality: None,
1584
- mut loop_ret: None,
1585
- llargs: HashMap(),
1586
- lllocals: HashMap(),
1587
- llupvars: HashMap(),
1591
+ llstaticallocas: llbbs.sa,
1592
+ llloadenv: None,
1593
+ llreturn: llbbs.rt,
1594
+ llself: None,
1595
+ personality: None,
1596
+ loop_ret: None,
1597
+ llargs: @ HashMap(),
1598
+ lllocals: @ HashMap(),
1599
+ llupvars: @ HashMap(),
1588
1600
id: id,
1589
1601
impl_id: impl_id,
1590
1602
param_substs: param_substs,
1591
1603
span: sp,
1592
1604
path: path,
1593
- ccx: ccx
1605
+ ccx: @ ccx
1594
1606
};
1595
1607
}
1596
1608
@@ -1780,7 +1792,7 @@ pub fn trans_closure(ccx: @CrateContext,
1780
1792
llvm:: LLVMSetGC ( fcx. llfn , strategy) ;
1781
1793
}
1782
1794
}
1783
- ccx. uses_gc = true ;
1795
+ * ccx. uses_gc = true ;
1784
1796
}
1785
1797
1786
1798
// Create the first basic block in the function and keep a handle on it to
@@ -2803,7 +2815,7 @@ pub fn trap(bcx: block) {
2803
2815
}
2804
2816
2805
2817
pub fn decl_gc_metadata(ccx: @CrateContext, llmod_id: ~str) {
2806
- if !ccx.sess.opts.gc || !ccx.uses_gc {
2818
+ if !ccx.sess.opts.gc || !* ccx.uses_gc {
2807
2819
return;
2808
2820
}
2809
2821
@@ -3038,7 +3050,7 @@ pub fn trans_crate(sess: session::Session,
3038
3050
discrims: HashMap(),
3039
3051
discrim_symbols: HashMap(),
3040
3052
tydescs: ty::new_ty_hash(),
3041
- mut finished_tydescs: false,
3053
+ finished_tydescs: @mut false,
3042
3054
external: HashMap(),
3043
3055
monomorphized: HashMap(),
3044
3056
monomorphizing: HashMap(),
@@ -3080,9 +3092,9 @@ pub fn trans_crate(sess: session::Session,
3080
3092
builder: BuilderRef_res(unsafe { llvm::LLVMCreateBuilder() }),
3081
3093
shape_cx: mk_ctxt(llmod),
3082
3094
crate_map: crate_map,
3083
- mut uses_gc: false,
3095
+ uses_gc: @mut false,
3084
3096
dbg_cx: dbg_cx,
3085
- mut do_not_commit_warning_issued: false
3097
+ do_not_commit_warning_issued: @mut false
3086
3098
};
3087
3099
3088
3100
{
0 commit comments