]> git.lizzy.rs Git - rust.git/commitdiff
Update E0009 to new format
authorJacob <jacob@yola.com>
Wed, 17 Aug 2016 05:21:31 +0000 (22:21 -0700)
committerJacob <jacob@yola.com>
Wed, 17 Aug 2016 05:21:31 +0000 (22:21 -0700)
src/librustc_const_eval/check_match.rs
src/test/compile-fail/E0009.rs

index 20673dc1e181addb0148222acba2c7c3edec2d24..a85fd896f0f954c8857fcdce656f22991fedbc51 100644 (file)
@@ -1120,10 +1120,11 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
                 .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");
-            span_note!(&mut err, by_ref_span.unwrap(), "by-ref binding occurs here");
-            err.emit();
+            struct_span_err!(cx.tcx.sess, p.span, E0009,
+                            "cannot bind by-move and by-ref in the same pattern")
+                    .span_label(p.span, &format!("by-move pattern here"))
+                    .span_label(by_ref_span.unwrap(), &format!("both by-ref and by-move used"))
+                    .emit();
         }
     };
 
index 51f71ea10c9e4e41e290fe87b3db17942951f2fe..4ce3b72e449df5c1a613eeb461ae3ded1901746e 100644 (file)
@@ -12,7 +12,10 @@ fn main() {
     struct X { x: (), }
     let x = Some((X { x: () }, X { x: () }));
     match x {
-        Some((y, ref z)) => {}, //~ ERROR E0009
+        Some((y, ref z)) => {}, 
+        //~^ ERROR E0009
+        //~| NOTE by-move pattern here
+        //~| NOTE both by-ref and by-move used
         None => panic!()
     }
 }