about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-17 06:25:28 -0700
committerGitHub <noreply@github.com>2016-08-17 06:25:28 -0700
commitc216617cf291a577fc0309ff81e8a58598c11a1e (patch)
treec468e064fe04994bc3a899ac48e22a1d61b7eb61
parentfbc62afba63dc2431c98c881403a53f0ccce1d0a (diff)
parent4cfdf634c18421e607779ad83c7e7bda642cc349 (diff)
downloadrust-c216617cf291a577fc0309ff81e8a58598c11a1e.tar.gz
rust-c216617cf291a577fc0309ff81e8a58598c11a1e.zip
Rollup merge of #35731 - pythoneer:fix-35192, r=jonathandturner
Update E0005 to use a label

Fixes #35192 as Part of #35233

r? @jonathandturner
-rw-r--r--src/librustc_const_eval/check_match.rs7
-rw-r--r--src/test/compile-fail/E0005.rs1
2 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs
index bf6ebcb5efe..5db293f5bb0 100644
--- a/src/librustc_const_eval/check_match.rs
+++ b/src/librustc_const_eval/check_match.rs
@@ -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();
     });
 }
 
diff --git a/src/test/compile-fail/E0005.rs b/src/test/compile-fail/E0005.rs
index 0405bba81b5..809b3af3bea 100644
--- a/src/test/compile-fail/E0005.rs
+++ b/src/test/compile-fail/E0005.rs
@@ -11,4 +11,5 @@
 fn main() {
     let x = Some(1);
     let Some(y) = x; //~ ERROR E0005
+    //~| NOTE pattern `None` not covered
 }