Skip to content

Commit 8728b09

Browse files
committed
librustc: De-@mut ScopeInfo::landing_pad
1 parent 7acaa73 commit 8728b09

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ pub fn need_invoke(bcx: @Block) -> bool {
997997
pub fn have_cached_lpad(bcx: @Block) -> bool {
998998
let mut res = false;
999999
in_lpad_scope_cx(bcx, |inf| {
1000-
match inf.landing_pad {
1000+
match inf.landing_pad.get() {
10011001
Some(_) => res = true,
10021002
None => res = false
10031003
}
@@ -1032,11 +1032,11 @@ pub fn get_landing_pad(bcx: @Block) -> BasicBlockRef {
10321032
let mut pad_bcx = bcx; // Guaranteed to be set below
10331033
in_lpad_scope_cx(bcx, |inf| {
10341034
// If there is a valid landing pad still around, use it
1035-
match inf.landing_pad {
1035+
match inf.landing_pad.get() {
10361036
Some(target) => cached = Some(target),
10371037
None => {
10381038
pad_bcx = lpad_block(bcx, "unwind");
1039-
inf.landing_pad = Some(pad_bcx.llbb);
1039+
inf.landing_pad.set(Some(pad_bcx.llbb));
10401040
}
10411041
}
10421042
});
@@ -1224,7 +1224,7 @@ pub fn simple_block_scope(parent: Option<@mut ScopeInfo>,
12241224
loop_label: None,
12251225
cleanups: RefCell::new(~[]),
12261226
cleanup_paths: RefCell::new(~[]),
1227-
landing_pad: None,
1227+
landing_pad: Cell::new(None),
12281228
node_info: node_info,
12291229
}
12301230
}
@@ -1254,7 +1254,7 @@ pub fn loop_scope_block(bcx: @Block,
12541254
loop_label: loop_label,
12551255
cleanups: RefCell::new(~[]),
12561256
cleanup_paths: RefCell::new(~[]),
1257-
landing_pad: None,
1257+
landing_pad: Cell::new(None),
12581258
node_info: opt_node_info,
12591259
}), bcx.is_lpad, n, opt_node_info);
12601260
}

src/librustc/middle/trans/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ pub struct cleanup_path {
431431
}
432432

433433
pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
434-
scope_info.landing_pad = None;
434+
scope_info.landing_pad.set(None);
435435
let new_cleanup_paths = {
436436
let cleanup_paths = scope_info.cleanup_paths.borrow();
437437
cleanup_paths.get()
@@ -444,7 +444,7 @@ pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
444444
}
445445

446446
pub fn grow_scope_clean(scope_info: &mut ScopeInfo) {
447-
scope_info.landing_pad = None;
447+
scope_info.landing_pad.set(None);
448448
}
449449

450450
pub fn cleanup_type(cx: ty::ctxt, ty: ty::t) -> cleantype {
@@ -634,7 +634,7 @@ pub struct ScopeInfo {
634634
// cleared when the set of cleanups changes.
635635
cleanup_paths: RefCell<~[cleanup_path]>,
636636
// Unwinding landing pad. Also cleared when cleanups change.
637-
landing_pad: Option<BasicBlockRef>,
637+
landing_pad: Cell<Option<BasicBlockRef>>,
638638
// info about the AST node this scope originated from, if any
639639
node_info: Option<NodeInfo>,
640640
}

0 commit comments

Comments
 (0)