Skip to content

Commit 11be7c0

Browse files
author
Jonathan Turner
authored
Rollup merge of #35731 - pythoneer:fix-35192, r=jonathandturner
Update E0005 to use a label Fixes #35192 as Part of #35233 r? @jonathandturner
2 parents df55192 + 4cfdf63 commit 11be7c0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/librustc_const_eval/check_match.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1073,11 +1073,12 @@ fn check_irrefutable(cx: &MatchCheckCtxt, pat: &Pat, is_fn_arg: bool) {
10731073
};
10741074

10751075
is_refutable(cx, pat, |uncovered_pat| {
1076-
span_err!(cx.tcx.sess, pat.span, E0005,
1076+
let pattern_string = pat_to_string(uncovered_pat);
1077+
struct_span_err!(cx.tcx.sess, pat.span, E0005,
10771078
"refutable pattern in {}: `{}` not covered",
10781079
origin,
1079-
pat_to_string(uncovered_pat),
1080-
);
1080+
pattern_string,
1081+
).span_label(pat.span, &format!("pattern `{}` not covered", pattern_string)).emit();
10811082
});
10821083
}
10831084

src/test/compile-fail/E0005.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
fn main() {
1212
let x = Some(1);
1313
let Some(y) = x; //~ ERROR E0005
14+
//~| NOTE pattern `None` not covered
1415
}

0 commit comments

Comments
 (0)