Skip to content

Commit bd08889

Browse files
committed
librustc: De-@mut IrMaps::capture_info_map
1 parent 30b8f8b commit bd08889

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
@@ -249,7 +249,7 @@ struct IrMaps {
249249
num_vars: Cell<uint>,
250250
live_node_map: RefCell<HashMap<NodeId, LiveNode>>,
251251
variable_map: RefCell<HashMap<NodeId, Variable>>,
252-
capture_info_map: HashMap<NodeId, @~[CaptureInfo]>,
252+
capture_info_map: RefCell<HashMap<NodeId, @~[CaptureInfo]>>,
253253
var_kinds: ~[VarKind],
254254
lnks: ~[LiveNodeKind],
255255
}
@@ -266,7 +266,7 @@ fn IrMaps(tcx: ty::ctxt,
266266
num_vars: Cell::new(0),
267267
live_node_map: RefCell::new(HashMap::new()),
268268
variable_map: RefCell::new(HashMap::new()),
269-
capture_info_map: HashMap::new(),
269+
capture_info_map: RefCell::new(HashMap::new()),
270270
var_kinds: ~[],
271271
lnks: ~[],
272272
}
@@ -334,11 +334,13 @@ impl IrMaps {
334334
}
335335
336336
pub fn set_captures(&mut self, node_id: NodeId, cs: ~[CaptureInfo]) {
337-
self.capture_info_map.insert(node_id, @cs);
337+
let mut capture_info_map = self.capture_info_map.borrow_mut();
338+
capture_info_map.get().insert(node_id, @cs);
338339
}
339340
340341
pub fn captures(&mut self, expr: &Expr) -> @~[CaptureInfo] {
341-
match self.capture_info_map.find(&expr.id) {
342+
let capture_info_map = self.capture_info_map.borrow();
343+
match capture_info_map.get().find(&expr.id) {
342344
Some(&caps) => caps,
343345
None => {
344346
self.tcx.sess.span_bug(expr.span, "no registered caps");

0 commit comments

Comments
 (0)