about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsrdja <sp@srdja.me>2016-08-08 23:36:50 +0200
committersrdja <sp@srdja.me>2016-08-08 23:36:50 +0200
commit0cb8439aa3ce2b19b3965fdfa3b244004206bfe2 (patch)
treeb7e50c8d794707775010f15947f7db0c8d676e60
parentb42a384a8078d79b299f2029b6c183b5e9288062 (diff)
downloadrust-0cb8439aa3ce2b19b3965fdfa3b244004206bfe2.tar.gz
rust-0cb8439aa3ce2b19b3965fdfa3b244004206bfe2.zip
Update E0008 to new format
-rw-r--r--src/librustc_const_eval/check_match.rs5
-rw-r--r--src/test/compile-fail/E0008.rs4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index 599e3ec871a..b3485e6fe5b 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -1114,7 +1114,10 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
         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");
         } else if has_guard {
-            span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard");
+            struct_span_err!(cx.tcx.sess, p.span, E0008,
+                      "cannot bind by-move into a pattern guard")
+                .span_label(p.span, &format!("moves value into pattern guard"))
+                .emit();
         } else if by_ref_span.is_some() {
             let mut err = struct_span_err!(cx.tcx.sess, p.span, E0009,
                                            "cannot bind by-move and by-ref in the same pattern");
diff --git a/src/test/compile-fail/E0008.rs b/src/test/compile-fail/E0008.rs
index 97dd0f368bd..20cc1cbd223 100644
--- a/src/test/compile-fail/E0008.rs
+++ b/src/test/compile-fail/E0008.rs
@@ -10,7 +10,9 @@
 
 fn main() {
     match Some("hi".to_string()) {
-        Some(s) if s.len() == 0 => {}, //~ ERROR E0008
+        Some(s) if s.len() == 0 => {},
+        //~^ ERROR E0008
+        //~| NOTE moves value into pattern guard
         _ => {},
     }
 }