Skip to content

Commit ab29003

Browse files
committed
---
yaml --- r: 97103 b: refs/heads/dist-snap c: d9c87c7 h: refs/heads/master i: 97101: b5b2580 97099: 751646d 97095: 8d91bd9 97087: 4879f2a v: v3
1 parent fc1bfc9 commit ab29003

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: f7393d86580b6b417063b48c9ad4c03829d03713
9+
refs/heads/dist-snap: d9c87c7a2374dbdc5d5662af8548e95bbb616584
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/borrowck/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ impl BorrowckCtxt {
475475
}
476476

477477
pub fn is_move(&self, id: ast::NodeId) -> bool {
478-
self.moves_map.contains(&id)
478+
let moves_map = self.moves_map.borrow();
479+
moves_map.get().contains(&id)
479480
}
480481

481482
pub fn cat_expr(&self, expr: @ast::Expr) -> mc::cmt {

branches/dist-snap/src/librustc/middle/check_match.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,8 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
889889
by_ref_span = Some(span);
890890
}
891891
BindByValue(_) => {
892-
if cx.moves_map.contains(&id) {
892+
let moves_map = cx.moves_map.borrow();
893+
if moves_map.get().contains(&id) {
893894
any_by_move = true;
894895
}
895896
}
@@ -926,7 +927,8 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
926927
if pat_is_binding(def_map, p) {
927928
match p.node {
928929
PatIdent(_, _, sub) => {
929-
if cx.moves_map.contains(&p.id) {
930+
let moves_map = cx.moves_map.borrow();
931+
if moves_map.get().contains(&p.id) {
930932
check_move(p, sub);
931933
}
932934
}

branches/dist-snap/src/librustc/middle/moves.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub struct CaptureVar {
161161

162162
pub type CaptureMap = @RefCell<HashMap<NodeId, @[CaptureVar]>>;
163163

164-
pub type MovesMap = @mut HashSet<NodeId>;
164+
pub type MovesMap = @RefCell<HashSet<NodeId>>;
165165

166166
/**
167167
* Set of variable node-ids that are moved.
@@ -215,7 +215,7 @@ pub fn compute_moves(tcx: ty::ctxt,
215215
tcx: tcx,
216216
method_map: method_map,
217217
move_maps: MoveMaps {
218-
moves_map: @mut HashSet::new(),
218+
moves_map: @RefCell::new(HashSet::new()),
219219
capture_map: @RefCell::new(HashMap::new()),
220220
moved_variables_set: @mut HashSet::new()
221221
}
@@ -283,7 +283,10 @@ impl VisitContext {
283283

284284
let expr_ty = ty::expr_ty_adjusted(self.tcx, expr);
285285
if ty::type_moves_by_default(self.tcx, expr_ty) {
286-
self.move_maps.moves_map.insert(expr.id);
286+
{
287+
let mut moves_map = self.move_maps.moves_map.borrow_mut();
288+
moves_map.get().insert(expr.id);
289+
}
287290
self.use_expr(expr, Move);
288291
} else {
289292
self.use_expr(expr, Read);
@@ -388,7 +391,12 @@ impl VisitContext {
388391
// closures should be noncopyable, they shouldn't move by default;
389392
// calling a closure should only consume it if it's once.
390393
if mode == Move {
391-
self.move_maps.moves_map.insert(callee.id);
394+
{
395+
let mut moves_map = self.move_maps
396+
.moves_map
397+
.borrow_mut();
398+
moves_map.get().insert(callee.id);
399+
}
392400
}
393401
self.use_expr(callee, mode);
394402
self.use_fn_args(callee.id, *args);
@@ -643,7 +651,10 @@ impl VisitContext {
643651
id, bm, binding_moves);
644652

645653
if binding_moves {
646-
self.move_maps.moves_map.insert(id);
654+
{
655+
let mut moves_map = self.move_maps.moves_map.borrow_mut();
656+
moves_map.get().insert(id);
657+
}
647658
}
648659
})
649660
}

0 commit comments

Comments
 (0)