From 7675e4b514f9ad3095ad830488861777cfd6c198 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 16 Aug 2016 22:21:31 -0700 Subject: [PATCH 1/2] Update E0009 to new format --- src/librustc_const_eval/check_match.rs | 9 +++++---- src/test/compile-fail/E0009.rs | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 20673dc1e181a..a85fd896f0f95 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -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(); } }; diff --git a/src/test/compile-fail/E0009.rs b/src/test/compile-fail/E0009.rs index 51f71ea10c9e4..4ce3b72e449df 100644 --- a/src/test/compile-fail/E0009.rs +++ b/src/test/compile-fail/E0009.rs @@ -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!() } } From d01bfb122e195696e72178e967191999c8745df4 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 17 Aug 2016 10:21:15 -0700 Subject: [PATCH 2/2] Remove trailing white space --- src/test/compile-fail/E0009.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/compile-fail/E0009.rs b/src/test/compile-fail/E0009.rs index 4ce3b72e449df..767fc0cc5dc07 100644 --- a/src/test/compile-fail/E0009.rs +++ b/src/test/compile-fail/E0009.rs @@ -12,7 +12,7 @@ fn main() { struct X { x: (), } let x = Some((X { x: () }, X { x: () })); match x { - Some((y, ref z)) => {}, + Some((y, ref z)) => {}, //~^ ERROR E0009 //~| NOTE by-move pattern here //~| NOTE both by-ref and by-move used