Skip to content

Commit cd5168b

Browse files
committed
librustc: De-@mut FunctionContext::llself
1 parent bd6a223 commit cd5168b

File tree

3 files changed

+8
-8
lines changed

3 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
@@ -1689,7 +1689,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
16891689
entry_bcx: None,
16901690
alloca_insert_pt: Cell::new(None),
16911691
llreturn: Cell::new(None),
1692-
llself: None,
1692+
llself: Cell::new(None),
16931693
personality: None,
16941694
caller_expects_out_pointer: uses_outptr,
16951695
llargs: RefCell::new(HashMap::new()),
@@ -1760,11 +1760,11 @@ pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
17601760

17611761
match self_arg {
17621762
impl_self(tt, self_mode) => {
1763-
cx.llself = Some(ValSelfData {
1763+
cx.llself.set(Some(ValSelfData {
17641764
v: cx.llenv.get(),
17651765
t: tt,
17661766
is_copy: self_mode == ty::ByCopy
1767-
});
1767+
}));
17681768
}
17691769
no_self => ()
17701770
}
@@ -1788,7 +1788,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
17881788
let _icx = push_ctxt("copy_args_to_allocas");
17891789
let mut bcx = bcx;
17901790

1791-
match fcx.llself {
1791+
match fcx.llself.get() {
17921792
Some(slf) => {
17931793
let self_val = if slf.is_copy
17941794
&& datum::appropriate_mode(bcx.ccx(), slf.t).is_by_value() {
@@ -1800,7 +1800,7 @@ pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
18001800
PointerCast(bcx, slf.v, type_of(bcx.ccx(), slf.t).ptr_to())
18011801
};
18021802

1803-
fcx.llself = Some(ValSelfData {v: self_val, ..slf});
1803+
fcx.llself.set(Some(ValSelfData {v: self_val, ..slf}));
18041804
add_clean(bcx, self_val, slf.t);
18051805

18061806
if fcx.ccx.sess.opts.extra_debuginfo {

src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub struct FunctionContext {
229229
// NB: This is the type of the self *variable*, not the self *type*. The
230230
// self type is set only for default methods, while the self variable is
231231
// set for all methods.
232-
llself: Option<ValSelfData>,
232+
llself: Cell<Option<ValSelfData>>,
233233
// The a value alloca'd for calls to upcalls.rust_personality. Used when
234234
// outputting the resume instruction.
235235
personality: Option<ValueRef>,

src/librustc/middle/trans/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,8 @@ pub fn trans_local_var(bcx: @Block, def: ast::Def) -> Datum {
11081108
take_local(bcx, lllocals.get(), nid)
11091109
}
11101110
ast::DefSelf(nid, _) => {
1111-
let self_info: ValSelfData = match bcx.fcx.llself {
1112-
Some(ref self_info) => *self_info,
1111+
let self_info: ValSelfData = match bcx.fcx.llself.get() {
1112+
Some(self_info) => self_info,
11131113
None => {
11141114
bcx.sess().bug(format!(
11151115
"trans_local_var: reference to self \

0 commit comments

Comments
 (0)