Skip to content

Commit 824cbe2

Browse files
committed
---
yaml --- r: 33951 b: refs/heads/snap-stage3 c: 7203be1 h: refs/heads/master i: 33949: adf266b 33947: 4cccb6f 33943: 1eadd91 33935: 009c3e0 33919: ecb866d v: v3
1 parent cfe63b1 commit 824cbe2

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: b58e1f6690c16ee77e21cfab145a0ee307a00695
4+
refs/heads/snap-stage3: 7203be1109d6e29dce14a842d454922c665ade3f
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
316316
match st.tcx.rcache.find({cnum: st.crate, pos: pos, len: len}) {
317317
Some(tt) => return tt,
318318
None => {
319-
let ps = @{pos: pos ,.. *st};
319+
let ps = @{pos: pos ,.. copy *st};
320320
let tt = parse_ty(ps, conv);
321321
st.tcx.rcache.insert({cnum: st.crate, pos: pos, len: len}, tt);
322322
return tt;

branches/snap-stage3/src/librustc/middle/mode.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ use middle::typeck::{method_map, method_map_entry};
44

55
use core::vec;
66
use std::map::HashMap;
7-
use syntax::ast::{by_copy, by_move, by_ref, by_val, crate, expr, expr_assign};
8-
use syntax::ast::{expr_addr_of, expr_assign_op, expr_binary, expr_call};
9-
use syntax::ast::{expr_copy, expr_field, expr_index, expr_method_call};
10-
use syntax::ast::{expr_path, expr_swap, expr_unary, node_id, sty_uniq};
11-
use syntax::ast::{sty_value};
12-
use syntax::ast::{box, uniq, deref, not, neg, expr_match, expr_paren};
7+
use syntax::ast::{box, by_copy, by_move, by_ref, by_val, crate, deref, expr};
8+
use syntax::ast::{expr_addr_of, expr_assign, expr_assign_op, expr_binary};
9+
use syntax::ast::{expr_call, expr_copy, expr_field, expr_index, expr_match};
10+
use syntax::ast::{expr_method_call, expr_paren, expr_path, expr_swap};
11+
use syntax::ast::{expr_unary, neg, node_id, not, sty_uniq, sty_value, uniq};
1312
use syntax::visit;
1413
use syntax::visit::vt;
1514

@@ -115,17 +114,25 @@ fn compute_modes_for_expr(expr: @expr,
115114
compute_modes_for_expr(arg, arg_cx, v);
116115
}
117116
expr_unary(unop, arg) => {
118-
// Ditto.
119-
let arg_cx = VisitContext { mode: ReadValue, ..cx };
120-
compute_modes_for_expr(arg, arg_cx, v);
121-
122117
match unop {
123118
deref => {
119+
// Derefs function as reads.
120+
let arg_cx = VisitContext { mode: ReadValue, ..cx };
121+
compute_modes_for_expr(arg, arg_cx, v);
122+
124123
// This is an lvalue, so it needs a value mode recorded
125124
// for it.
126125
record_mode_for_expr(expr, cx);
127126
}
128-
box(_) | uniq(_) | not | neg => {}
127+
box(_) | uniq(_) => {
128+
let arg_cx = VisitContext { mode: MoveValue, ..cx };
129+
compute_modes_for_expr(arg, arg_cx, v);
130+
}
131+
not | neg => {
132+
// Takes its argument by ref.
133+
let arg_cx = VisitContext { mode: ReadValue, ..cx };
134+
compute_modes_for_expr(arg, arg_cx, v);
135+
}
129136
}
130137
}
131138
expr_field(arg, _, _) => {

branches/snap-stage3/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ fn check_block_no_value(fcx: @fn_ctxt, blk: ast::blk) -> bool {
24572457

24582458
fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
24592459
let fcx = match blk.node.rules {
2460-
ast::unsafe_blk => @fn_ctxt {purity: ast::unsafe_fn,.. *fcx0},
2460+
ast::unsafe_blk => @fn_ctxt {purity: ast::unsafe_fn,.. copy *fcx0},
24612461
ast::default_blk => fcx0
24622462
};
24632463
do fcx.with_region_lb(blk.node.id) {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn dup(x: ~int) -> ~(~int,~int) { ~(x, x) } //~ ERROR use of moved variable
2+
fn main() {
3+
dup(~3);
4+
}

0 commit comments

Comments
 (0)