diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs index ab56e8054712..1c0919f9000a 100644 --- a/src/librustc_trans/trans/context.rs +++ b/src/librustc_trans/trans/context.rs @@ -152,9 +152,9 @@ pub struct LocalCrateContext<'tcx> { dbg_cx: Option>, - eh_personality: RefCell>, - eh_unwind_resume: RefCell>, - rust_try_fn: RefCell>, + eh_personality: Cell>, + eh_unwind_resume: Cell>, + rust_try_fn: Cell>, intrinsics: RefCell>, @@ -492,9 +492,9 @@ impl<'tcx> LocalCrateContext<'tcx> { builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)), closure_vals: RefCell::new(FnvHashMap()), dbg_cx: dbg_cx, - eh_personality: RefCell::new(None), - eh_unwind_resume: RefCell::new(None), - rust_try_fn: RefCell::new(None), + eh_personality: Cell::new(None), + eh_unwind_resume: Cell::new(None), + rust_try_fn: Cell::new(None), intrinsics: RefCell::new(FnvHashMap()), n_llvm_insns: Cell::new(0), type_of_depth: Cell::new(0), @@ -754,15 +754,15 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { &self.local.dbg_cx } - pub fn eh_personality<'a>(&'a self) -> &'a RefCell> { + pub fn eh_personality<'a>(&'a self) -> &'a Cell> { &self.local.eh_personality } - pub fn eh_unwind_resume<'a>(&'a self) -> &'a RefCell> { + pub fn eh_unwind_resume<'a>(&'a self) -> &'a Cell> { &self.local.eh_unwind_resume } - pub fn rust_try_fn<'a>(&'a self) -> &'a RefCell> { + pub fn rust_try_fn<'a>(&'a self) -> &'a Cell> { &self.local.rust_try_fn } diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 46afeaa4d9e7..7494cf2975ad 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -1295,8 +1295,8 @@ fn get_rust_try_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>, trans: &mut for<'b> FnMut(Block<'b, 'tcx>)) -> ValueRef { let ccx = fcx.ccx; - if let Some(llfn) = *ccx.rust_try_fn().borrow() { - return llfn + if let Some(llfn) = ccx.rust_try_fn().get() { + return llfn; } // Define the type up front for the signature of the rust_try function. @@ -1323,7 +1323,7 @@ fn get_rust_try_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>, }; let rust_try = gen_fn(fcx, "__rust_try", tcx.mk_fn_ptr(try_fn_ty), output, trans); - *ccx.rust_try_fn().borrow_mut() = Some(rust_try); + ccx.rust_try_fn().set(Some(rust_try)); return rust_try }