From 8728b09e78805672d0e948118b29064921da0278 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sat, 21 Dec 2013 15:58:54 -0800 Subject: [PATCH] librustc: De-`@mut` `ScopeInfo::landing_pad` --- src/librustc/middle/trans/base.rs | 10 +++++----- src/librustc/middle/trans/common.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index f576d1cc97a..4df8b2efdd5 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -997,7 +997,7 @@ pub fn need_invoke(bcx: @Block) -> bool { pub fn have_cached_lpad(bcx: @Block) -> bool { let mut res = false; in_lpad_scope_cx(bcx, |inf| { - match inf.landing_pad { + match inf.landing_pad.get() { Some(_) => res = true, None => res = false } @@ -1032,11 +1032,11 @@ pub fn get_landing_pad(bcx: @Block) -> BasicBlockRef { let mut pad_bcx = bcx; // Guaranteed to be set below in_lpad_scope_cx(bcx, |inf| { // If there is a valid landing pad still around, use it - match inf.landing_pad { + match inf.landing_pad.get() { Some(target) => cached = Some(target), None => { pad_bcx = lpad_block(bcx, "unwind"); - inf.landing_pad = Some(pad_bcx.llbb); + inf.landing_pad.set(Some(pad_bcx.llbb)); } } }); @@ -1224,7 +1224,7 @@ pub fn simple_block_scope(parent: Option<@mut ScopeInfo>, loop_label: None, cleanups: RefCell::new(~[]), cleanup_paths: RefCell::new(~[]), - landing_pad: None, + landing_pad: Cell::new(None), node_info: node_info, } } @@ -1254,7 +1254,7 @@ pub fn loop_scope_block(bcx: @Block, loop_label: loop_label, cleanups: RefCell::new(~[]), cleanup_paths: RefCell::new(~[]), - landing_pad: None, + landing_pad: Cell::new(None), node_info: opt_node_info, }), bcx.is_lpad, n, opt_node_info); } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 9940bdac8d8..26866ce3aef 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -431,7 +431,7 @@ pub struct cleanup_path { } pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) { - scope_info.landing_pad = None; + scope_info.landing_pad.set(None); let new_cleanup_paths = { let cleanup_paths = scope_info.cleanup_paths.borrow(); cleanup_paths.get() @@ -444,7 +444,7 @@ pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) { } pub fn grow_scope_clean(scope_info: &mut ScopeInfo) { - scope_info.landing_pad = None; + scope_info.landing_pad.set(None); } pub fn cleanup_type(cx: ty::ctxt, ty: ty::t) -> cleantype { @@ -634,7 +634,7 @@ pub struct ScopeInfo { // cleared when the set of cleanups changes. cleanup_paths: RefCell<~[cleanup_path]>, // Unwinding landing pad. Also cleared when cleanups change. - landing_pad: Option, + landing_pad: Cell>, // info about the AST node this scope originated from, if any node_info: Option, }