diff options
| author | srdja <sp@srdja.me> | 2016-08-08 23:36:50 +0200 |
|---|---|---|
| committer | srdja <sp@srdja.me> | 2016-08-08 23:36:50 +0200 |
| commit | 0cb8439aa3ce2b19b3965fdfa3b244004206bfe2 (patch) | |
| tree | b7e50c8d794707775010f15947f7db0c8d676e60 | |
| parent | b42a384a8078d79b299f2029b6c183b5e9288062 (diff) | |
| download | rust-0cb8439aa3ce2b19b3965fdfa3b244004206bfe2.tar.gz rust-0cb8439aa3ce2b19b3965fdfa3b244004206bfe2.zip | |
Update E0008 to new format
| -rw-r--r-- | src/librustc_const_eval/check_match.rs | 5 | ||||
| -rw-r--r-- | src/test/compile-fail/E0008.rs | 4 |
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 _ => {}, } } |
