Skip to content

Commit e5c399a

Browse files
committed
librustc: De-@mut IrMaps::live_node_map
1 parent 01ee2fb commit e5c399a

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
@@ -247,7 +247,7 @@ struct IrMaps {
247247

248248
num_live_nodes: Cell<uint>,
249249
num_vars: Cell<uint>,
250-
live_node_map: HashMap<NodeId, LiveNode>,
250+
live_node_map: RefCell<HashMap<NodeId, LiveNode>>,
251251
variable_map: HashMap<NodeId, Variable>,
252252
capture_info_map: HashMap<NodeId, @~[CaptureInfo]>,
253253
var_kinds: ~[VarKind],
@@ -264,7 +264,7 @@ fn IrMaps(tcx: ty::ctxt,
264264
capture_map: capture_map,
265265
num_live_nodes: Cell::new(0),
266266
num_vars: Cell::new(0),
267-
live_node_map: HashMap::new(),
267+
live_node_map: RefCell::new(HashMap::new()),
268268
variable_map: HashMap::new(),
269269
capture_info_map: HashMap::new(),
270270
var_kinds: ~[],
@@ -289,7 +289,8 @@ impl IrMaps {
289289
node_id: NodeId,
290290
lnk: LiveNodeKind) {
291291
let ln = self.add_live_node(lnk);
292-
self.live_node_map.insert(node_id, ln);
292+
let mut live_node_map = self.live_node_map.borrow_mut();
293+
live_node_map.get().insert(node_id, ln);
293294

294295
debug!("{} is node {}", ln.to_str(), node_id);
295296
}
@@ -616,7 +617,8 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
616617
impl Liveness {
617618
pub fn live_node(&self, node_id: NodeId, span: Span) -> LiveNode {
618619
let ir: &mut IrMaps = self.ir;
619-
match ir.live_node_map.find(&node_id) {
620+
let live_node_map = ir.live_node_map.borrow();
621+
match live_node_map.get().find(&node_id) {
620622
Some(&ln) => ln,
621623
None => {
622624
// This must be a mismatch between the ir_map construction

0 commit comments

Comments
 (0)