Skip to content

Commit d74f1fb

Browse files
committed
---
yaml --- r: 147675 b: refs/heads/try2 c: 7d3e253 h: refs/heads/master i: 147673: 1b2e69e 147671: 493ec3a v: v3
1 parent 8f23bae commit d74f1fb

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1b8391ca12c5465a78673b0ba5ea4d338e487fb1
8+
refs/heads/try2: 7d3e25394f78bdcd9783460be26809807c8dacc1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/borrowck/move_data.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct MoveData {
3535
paths: RefCell<~[MovePath]>,
3636

3737
/// Cache of loan path to move path index, for easy lookup.
38-
path_map: HashMap<@LoanPath, MovePathIndex>,
38+
path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
3939

4040
/// Each move or uninitialized variable gets an entry here.
4141
moves: RefCell<~[Move]>,
@@ -166,7 +166,7 @@ impl MoveData {
166166
pub fn new() -> MoveData {
167167
MoveData {
168168
paths: RefCell::new(~[]),
169-
path_map: HashMap::new(),
169+
path_map: RefCell::new(HashMap::new()),
170170
moves: RefCell::new(~[]),
171171
path_assignments: ~[],
172172
var_assignments: ~[],
@@ -234,11 +234,14 @@ impl MoveData {
234234
* base paths that do not yet have an index.
235235
*/
236236

237-
match self.path_map.find(&lp) {
238-
Some(&index) => {
239-
return index;
237+
{
238+
let path_map = self.path_map.borrow();
239+
match path_map.get().find(&lp) {
240+
Some(&index) => {
241+
return index;
242+
}
243+
None => {}
240244
}
241-
None => {}
242245
}
243246

244247
let index = match *lp {
@@ -289,14 +292,17 @@ impl MoveData {
289292

290293
let paths = self.paths.borrow();
291294
assert_eq!(*index, paths.get().len() - 1);
292-
self.path_map.insert(lp, index);
295+
296+
let mut path_map = self.path_map.borrow_mut();
297+
path_map.get().insert(lp, index);
293298
return index;
294299
}
295300

296301
fn existing_move_path(&self,
297302
lp: @LoanPath)
298303
-> Option<MovePathIndex> {
299-
self.path_map.find_copy(&lp)
304+
let path_map = self.path_map.borrow();
305+
path_map.get().find_copy(&lp)
300306
}
301307

302308
fn existing_base_paths(&self,
@@ -315,7 +321,11 @@ impl MoveData {
315321
* paths of `lp` to `result`, but does not add new move paths
316322
*/
317323

318-
match self.path_map.find_copy(&lp) {
324+
let index_opt = {
325+
let path_map = self.path_map.borrow();
326+
path_map.get().find_copy(&lp)
327+
};
328+
match index_opt {
319329
Some(index) => {
320330
self.each_base_path(index, |p| {
321331
result.push(p);
@@ -442,7 +452,10 @@ impl MoveData {
442452
match *path.loan_path {
443453
LpVar(id) => {
444454
let kill_id = tcx.region_maps.encl_scope(id);
445-
let path = *self.path_map.get(&path.loan_path);
455+
let path = {
456+
let path_map = self.path_map.borrow();
457+
*path_map.get().get(&path.loan_path)
458+
};
446459
self.kill_moves(path, kill_id, dfcx_moves);
447460
}
448461
LpExtend(..) => {}

0 commit comments

Comments
 (0)