Skip to content

Commit 30b8f8b

Browse files
committed
librustc: De-@mut IrMaps::variable_map
1 parent e5c399a commit 30b8f8b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc/middle/liveness.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ struct IrMaps {
248248
num_live_nodes: Cell<uint>,
249249
num_vars: Cell<uint>,
250250
live_node_map: RefCell<HashMap<NodeId, LiveNode>>,
251-
variable_map: HashMap<NodeId, Variable>,
251+
variable_map: RefCell<HashMap<NodeId, Variable>>,
252252
capture_info_map: HashMap<NodeId, @~[CaptureInfo]>,
253253
var_kinds: ~[VarKind],
254254
lnks: ~[LiveNodeKind],
@@ -265,7 +265,7 @@ fn IrMaps(tcx: ty::ctxt,
265265
num_live_nodes: Cell::new(0),
266266
num_vars: Cell::new(0),
267267
live_node_map: RefCell::new(HashMap::new()),
268-
variable_map: HashMap::new(),
268+
variable_map: RefCell::new(HashMap::new()),
269269
capture_info_map: HashMap::new(),
270270
var_kinds: ~[],
271271
lnks: ~[],
@@ -302,7 +302,8 @@ impl IrMaps {
302302

303303
match vk {
304304
Local(LocalInfo { id: node_id, .. }) | Arg(node_id, _) => {
305-
self.variable_map.insert(node_id, v);
305+
let mut variable_map = self.variable_map.borrow_mut();
306+
variable_map.get().insert(node_id, v);
306307
},
307308
ImplicitRet => {}
308309
}
@@ -313,7 +314,8 @@ impl IrMaps {
313314
}
314315

315316
pub fn variable(&mut self, node_id: NodeId, span: Span) -> Variable {
316-
match self.variable_map.find(&node_id) {
317+
let variable_map = self.variable_map.borrow();
318+
match variable_map.get().find(&node_id) {
317319
Some(&var) => var,
318320
None => {
319321
self.tcx.sess.span_bug(

0 commit comments

Comments
 (0)