diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 87b4ac140b6c..76c2b08a8332 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -74,6 +74,7 @@ fn check_crate(tcx: ty::ctxt, last_use_map: last_use_map, current_item: -1}; let visit = visit::mk_vt(@{ + visit_arm: check_arm, visit_expr: check_expr, visit_stmt: check_stmt, visit_block: check_block, @@ -225,6 +226,19 @@ fn check_block(b: blk, cx: ctx, v: visit::vt) { visit::visit_block(b, cx, v); } +fn check_arm(a: arm, cx: ctx, v: visit::vt) { + for vec::each(a.pats) |p| { + do pat_util::pat_bindings(cx.tcx.def_map, p) |mode, id, span, _path| { + if mode == bind_by_value { + let t = ty::node_id_to_type(cx.tcx, id); + let reason = "consider binding with `ref` or `move` instead"; + check_copy(cx, id, t, span, false, some((reason,reason))); + } + } + } + visit::visit_arm(a, cx, v); +} + fn check_expr(e: @expr, cx: ctx, v: visit::vt) { debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr())); diff --git a/src/test/run-pass/pipe-presentation-examples.rs b/src/test/run-pass/pipe-presentation-examples.rs index eba21e329714..ad0a694165ed 100644 --- a/src/test/run-pass/pipe-presentation-examples.rs +++ b/src/test/run-pass/pipe-presentation-examples.rs @@ -23,8 +23,7 @@ macro_rules! select_if ( } => { if $index == $count { match move pipes::try_recv($port) { - $(some($message($($(copy $x,)+)* next)) => { - // FIXME (#2329) we really want move out of enum here. + $(some($message($($(move $x,)+)* next)) => { let $next = unsafe { let x <- *ptr::addr_of(next); x }; $e })+