]> git.lizzy.rs Git - rust.git/commitdiff
Update E0008 to new format
authorsrdja <sp@srdja.me>
Mon, 8 Aug 2016 21:36:50 +0000 (23:36 +0200)
committersrdja <sp@srdja.me>
Mon, 8 Aug 2016 21:36:50 +0000 (23:36 +0200)
src/librustc_const_eval/check_match.rs
src/test/compile-fail/E0008.rs

index 599e3ec871a8327cdcc08f18083a042806bd7945..b3485e6fe5be43285963832198ba3d56fa2095ea 100644 (file)
@@ -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");
index 97dd0f368bd12fd954cf8256b0d624e2cda35702..20cc1cbd2232df233d3e92734901b112247bc1a5 100644 (file)
@@ -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
         _ => {},
     }
 }