We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e47d2f6 commit 37bcd67Copy full SHA for 37bcd67
src/rustc/middle/kind.rs
@@ -74,6 +74,7 @@ fn check_crate(tcx: ty::ctxt,
74
last_use_map: last_use_map,
75
current_item: -1};
76
let visit = visit::mk_vt(@{
77
+ visit_arm: check_arm,
78
visit_expr: check_expr,
79
visit_stmt: check_stmt,
80
visit_block: check_block,
@@ -225,6 +226,19 @@ fn check_block(b: blk, cx: ctx, v: visit::vt<ctx>) {
225
226
visit::visit_block(b, cx, v);
227
}
228
229
+fn check_arm(a: arm, cx: ctx, v: visit::vt<ctx>) {
230
+ for vec::each(a.pats) |p| {
231
+ do pat_util::pat_bindings(cx.tcx.def_map, p) |mode, id, span, _path| {
232
+ if mode == bind_by_value {
233
+ let t = ty::node_id_to_type(cx.tcx, id);
234
+ let reason = "consider binding with `ref` or `move` instead";
235
+ check_copy(cx, id, t, span, false, some((reason,reason)));
236
+ }
237
238
239
+ visit::visit_arm(a, cx, v);
240
+}
241
+
242
fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
243
debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr()));
244
src/test/run-pass/pipe-presentation-examples.rs
@@ -23,8 +23,7 @@ macro_rules! select_if (
23
} => {
24
if $index == $count {
25
match move pipes::try_recv($port) {
26
- $(some($message($($(copy $x,)+)* next)) => {
27
- // FIXME (#2329) we really want move out of enum here.
+ $(some($message($($(move $x,)+)* next)) => {
28
let $next = unsafe { let x <- *ptr::addr_of(next); x };
29
$e
30
})+
0 commit comments