From aa40ec7f1155dc63bac19d218a56aec8109ac8e2 Mon Sep 17 00:00:00 2001 From: srdja Date: Tue, 9 Aug 2016 21:23:11 +0200 Subject: [PATCH] Update E0007 to new format --- src/librustc_const_eval/check_match.rs | 5 ++++- src/test/compile-fail/E0007.rs | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index b3485e6fe5b..3ca1b0cd636 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -1112,7 +1112,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt, // x @ Foo(..) is legal, but x @ Foo(y) isn't. if sub.map_or(false, |p| pat_contains_bindings(&p)) { - span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings"); + struct_span_err!(cx.tcx.sess, p.span, E0007, + "cannot bind by-move with sub-bindings") + .span_label(p.span, &format!("binds an already bound by-move value by moving it")) + .emit(); } else if has_guard { struct_span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard") diff --git a/src/test/compile-fail/E0007.rs b/src/test/compile-fail/E0007.rs index bfc0f1afe3a..4be115b8afd 100644 --- a/src/test/compile-fail/E0007.rs +++ b/src/test/compile-fail/E0007.rs @@ -11,8 +11,10 @@ fn main() { let x = Some("s".to_string()); match x { - op_string @ Some(s) => {}, //~ ERROR E0007 - //~| ERROR E0303 + op_string @ Some(s) => {}, + //~^ ERROR E0007 + //~| NOTE binds an already bound by-move value by moving it + //~| ERROR E0303 None => {}, } }