Skip to content

Commit e51f99a

Browse files
committed
---
yaml --- r: 89087 b: refs/heads/snap-stage3 c: eaf6949 h: refs/heads/master i: 89085: 387b7fa 89083: 381a585 89079: 27beea3 89071: 70a9786 89055: 918a05e 89023: 8e96055 88959: fa97590 88831: b60752b 88575: fc71c77 88063: c522f9e v: v3
1 parent bcc14cf commit e51f99a

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 298d0b870ff9201ee05c5517ade88da84a61cdf1
4+
refs/heads/snap-stage3: eaf69494a5a126189b052102e1b36d1d8bced953
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ pub struct Liveness {
594594
users: @mut ~[Users],
595595
// The list of node IDs for the nested loop scopes
596596
// we're in.
597-
loop_scope: @mut ~[NodeId],
597+
loop_scope: @RefCell<~[NodeId]>,
598598
// mappings from loop node ID to LiveNode
599599
// ("break" label should map to loop node ID,
600600
// it probably doesn't now)
@@ -612,7 +612,7 @@ fn Liveness(ir: @IrMaps, specials: Specials) -> Liveness {
612612
users: @mut vec::from_elem(ir.num_live_nodes.get() *
613613
ir.num_vars.get(),
614614
invalid_users()),
615-
loop_scope: @mut ~[],
615+
loop_scope: @RefCell::new(~[]),
616616
break_ln: @RefCell::new(HashMap::new()),
617617
cont_ln: @RefCell::new(HashMap::new()),
618618
}
@@ -762,7 +762,8 @@ impl Liveness {
762762
None => {
763763
// Vanilla 'break' or 'loop', so use the enclosing
764764
// loop scope
765-
if self.loop_scope.len() == 0 {
765+
let loop_scope = self.loop_scope.borrow();
766+
if loop_scope.get().len() == 0 {
766767
self.tcx.sess.span_bug(sp, "break outside loop");
767768
} else {
768769
// FIXME(#5275): this shouldn't have to be a method...
@@ -773,8 +774,8 @@ impl Liveness {
773774
}
774775

775776
pub fn last_loop_scope(&self) -> NodeId {
776-
let loop_scope = &mut *self.loop_scope;
777-
*loop_scope.last()
777+
let loop_scope = self.loop_scope.borrow();
778+
*loop_scope.get().last()
778779
}
779780

780781
pub fn ln_str(&self, ln: LiveNode) -> ~str {
@@ -1418,16 +1419,22 @@ impl Liveness {
14181419
cont_ln: LiveNode,
14191420
f: || -> R)
14201421
-> R {
1421-
debug!("with_loop_nodes: {} {}", loop_node_id, *break_ln);
1422-
self.loop_scope.push(loop_node_id);
1422+
debug!("with_loop_nodes: {} {}", loop_node_id, *break_ln);
1423+
{
1424+
let mut loop_scope = self.loop_scope.borrow_mut();
1425+
loop_scope.get().push(loop_node_id);
1426+
}
14231427
{
14241428
let mut this_break_ln = self.break_ln.borrow_mut();
14251429
let mut this_cont_ln = self.cont_ln.borrow_mut();
14261430
this_break_ln.get().insert(loop_node_id, break_ln);
14271431
this_cont_ln.get().insert(loop_node_id, cont_ln);
14281432
}
14291433
let r = f();
1430-
self.loop_scope.pop();
1434+
{
1435+
let mut loop_scope = self.loop_scope.borrow_mut();
1436+
loop_scope.get().pop();
1437+
}
14311438
r
14321439
}
14331440
}

0 commit comments

Comments
 (0)