Skip to content

Commit 4603057

Browse files
committed
librustc: De-@mut MoveData::path_assignments
1 parent 7d3e253 commit 4603057

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/librustc/middle/borrowck/move_data.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct MoveData {
4848
/// Assignments to a path, like `x.f = foo`. These are not
4949
/// assigned dataflow bits, but we track them because they still
5050
/// kill move bits.
51-
path_assignments: ~[Assignment],
51+
path_assignments: RefCell<~[Assignment]>,
5252
assignee_ids: HashSet<ast::NodeId>,
5353
}
5454

@@ -168,7 +168,7 @@ impl MoveData {
168168
paths: RefCell::new(~[]),
169169
path_map: RefCell::new(HashMap::new()),
170170
moves: RefCell::new(~[]),
171-
path_assignments: ~[],
171+
path_assignments: RefCell::new(~[]),
172172
var_assignments: ~[],
173173
assignee_ids: HashSet::new(),
174174
}
@@ -412,7 +412,10 @@ impl MoveData {
412412
debug!("add_assignment[path](lp={}, path_index={:?})",
413413
lp.repr(tcx), path_index);
414414

415-
self.path_assignments.push(assignment);
415+
{
416+
let mut path_assignments = self.path_assignments.borrow_mut();
417+
path_assignments.get().push(assignment);
418+
}
416419
}
417420
}
418421

@@ -440,8 +443,11 @@ impl MoveData {
440443
self.kill_moves(assignment.path, assignment.id, dfcx_moves);
441444
}
442445

443-
for assignment in self.path_assignments.iter() {
444-
self.kill_moves(assignment.path, assignment.id, dfcx_moves);
446+
{
447+
let path_assignments = self.path_assignments.borrow();
448+
for assignment in path_assignments.get().iter() {
449+
self.kill_moves(assignment.path, assignment.id, dfcx_moves);
450+
}
445451
}
446452

447453
// Kill all moves related to a variable `x` when it goes out

0 commit comments

Comments
 (0)