Skip to content

Commit

Permalink
Rollup merge of #35731 - pythoneer:fix-35192, r=jonathandturner
Browse files Browse the repository at this point in the history
Update E0005 to use a label

Fixes #35192 as Part of #35233

r? @jonathandturner
  • Loading branch information
Jonathan Turner authored Aug 17, 2016
2 parents fbc62af + 4cfdf63 commit c216617
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,12 @@ fn check_irrefutable(cx: &MatchCheckCtxt, pat: &Pat, is_fn_arg: bool) {
};

is_refutable(cx, pat, |uncovered_pat| {
span_err!(cx.tcx.sess, pat.span, E0005,
let pattern_string = pat_to_string(uncovered_pat);
struct_span_err!(cx.tcx.sess, pat.span, E0005,
"refutable pattern in {}: `{}` not covered",
origin,
pat_to_string(uncovered_pat),
);
pattern_string,
).span_label(pat.span, &format!("pattern `{}` not covered", pattern_string)).emit();
});
}

Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0005.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
fn main() {
let x = Some(1);
let Some(y) = x; //~ ERROR E0005
//~| NOTE pattern `None` not covered
}

0 comments on commit c216617

Please sign in to comment.