Skip to content

Commit 5c1fcd9

Browse files
committed
---
yaml --- r: 14421 b: refs/heads/try c: 1e52662 h: refs/heads/master i: 14419: 7a26ea1 v: v3
1 parent 5807752 commit 5c1fcd9

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 8015e6d52b7eeea47f9e61c6ac42487935474ca4
5+
refs/heads/try: 1e5266260aad92973caeede3500f848c277f84e2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/comp/middle/mutbl.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ fn visit_expr(cx: @ctx, ex: @expr, &&e: (), v: visit::vt<()>) {
172172
expr_assign(dest, src) | expr_assign_op(_, dest, src) {
173173
check_lval(cx, dest, msg_assign);
174174
}
175+
expr_fn(_, _, _, cap) {
176+
for moved in cap.moves {
177+
let def = cx.tcx.def_map.get(moved.id);
178+
alt is_immutable_def(cx, def) {
179+
some(name) { mk_err(cx, moved.span, msg_move_out, moved.name); }
180+
_ { }
181+
}
182+
cx.mutbl_map.insert(ast_util::def_id_of_def(def).node, ());
183+
}
184+
}
175185
_ { }
176186
}
177187
visit::visit_expr(ex, e, v);

branches/try/src/comp/middle/trans/closure.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ fn build_closure(bcx0: block,
376376
env_vals += [env_move(lv.val, ty, lv.kind)];
377377
}
378378
capture::cap_drop {
379+
assert lv.kind == owned;
379380
bcx = drop_ty(bcx, lv.val, ty);
381+
bcx = zero_alloca(bcx, lv.val, ty);
380382
}
381383
}
382384
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
let x = ~1;
3+
let lam_move = fn@[move x]() { };
4+
lam_move();
5+
}

0 commit comments

Comments
 (0)