Skip to content

Commit

Permalink
Update E0008 to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
srdja committed Aug 8, 2016
1 parent b42a384 commit 0cb8439
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/E0008.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
_ => {},
}
}

0 comments on commit 0cb8439

Please sign in to comment.