Skip to content

Commit bef2353

Browse files
committed
librustc: De-@mut IrMaps::var_kinds
1 parent bd08889 commit bef2353

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/librustc/middle/liveness.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ struct IrMaps {
250250
live_node_map: RefCell<HashMap<NodeId, LiveNode>>,
251251
variable_map: RefCell<HashMap<NodeId, Variable>>,
252252
capture_info_map: RefCell<HashMap<NodeId, @~[CaptureInfo]>>,
253-
var_kinds: ~[VarKind],
253+
var_kinds: RefCell<~[VarKind]>,
254254
lnks: ~[LiveNodeKind],
255255
}
256256

@@ -267,7 +267,7 @@ fn IrMaps(tcx: ty::ctxt,
267267
live_node_map: RefCell::new(HashMap::new()),
268268
variable_map: RefCell::new(HashMap::new()),
269269
capture_info_map: RefCell::new(HashMap::new()),
270-
var_kinds: ~[],
270+
var_kinds: RefCell::new(~[]),
271271
lnks: ~[],
272272
}
273273
}
@@ -297,7 +297,10 @@ impl IrMaps {
297297

298298
pub fn add_variable(&mut self, vk: VarKind) -> Variable {
299299
let v = Variable(self.num_vars.get());
300-
self.var_kinds.push(vk);
300+
{
301+
let mut var_kinds = self.var_kinds.borrow_mut();
302+
var_kinds.get().push(vk);
303+
}
301304
self.num_vars.set(self.num_vars.get() + 1);
302305

303306
match vk {
@@ -325,7 +328,8 @@ impl IrMaps {
325328
}
326329

327330
pub fn variable_name(&mut self, var: Variable) -> @str {
328-
match self.var_kinds[*var] {
331+
let var_kinds = self.var_kinds.borrow();
332+
match var_kinds.get()[*var] {
329333
Local(LocalInfo { ident: nm, .. }) | Arg(_, nm) => {
330334
self.tcx.sess.str_of(nm)
331335
},

0 commit comments

Comments
 (0)