about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-10-14 12:07:07 -0700
committerGitHub <noreply@github.com>2016-10-14 12:07:07 -0700
commitcd0c70f430d00bc9ef850ec3ce0816ecd2aa88cc (patch)
tree7227270fe98e0573341885039e0ef7f11ba5086e /src
parent40cd1fdf0a951e2aa1a042c4cba613f5a2d50dcf (diff)
parent595b754a4b274dbc19fff740011e4b68df6dccf0 (diff)
downloadrust-cd0c70f430d00bc9ef850ec3ce0816ecd2aa88cc.tar.gz
rust-cd0c70f430d00bc9ef850ec3ce0816ecd2aa88cc.zip
Rollup merge of #36307 - faebser:E0408_new_error_format, r=GuillaumeGomez
Changed error message E0408 to new format

Followed your text and was able to change the ouput to the new format.
I did not encounter any broken test therefore this is a really small commit.

Thanks for letting me hack on the compiler :)

r? @jonathandturner
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/lib.rs6
-rw-r--r--src/test/compile-fail/E0408.rs4
-rw-r--r--src/test/compile-fail/issue-2848.rs4
-rw-r--r--src/test/compile-fail/resolve-inconsistent-names.rs6
4 files changed, 12 insertions, 8 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 6db844c1d03..83e66fdd3bc 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -276,13 +276,15 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
             err
         }
         ResolutionError::VariableNotBoundInPattern(variable_name, from, to) => {
-            struct_span_err!(resolver.session,
+            let mut err = struct_span_err!(resolver.session,
                              span,
                              E0408,
                              "variable `{}` from pattern #{} is not bound in pattern #{}",
                              variable_name,
                              from,
-                             to)
+                             to);
+            err.span_label(span, &format!("pattern doesn't bind `{}`", variable_name));
+            err
         }
         ResolutionError::VariableBoundWithDifferentMode(variable_name,
                                                         pattern_number,
diff --git a/src/test/compile-fail/E0408.rs b/src/test/compile-fail/E0408.rs
index 43f6d9d757d..d75f6124827 100644
--- a/src/test/compile-fail/E0408.rs
+++ b/src/test/compile-fail/E0408.rs
@@ -12,7 +12,7 @@ fn main() {
     let x = Some(0);
 
     match x {
-        Some(y) | None => {} //~ ERROR E0408
-        _ => ()
+        Some(y) | None => {} //~  ERROR variable `y` from pattern #1 is not bound in pattern #2
+        _ => ()              //~| NOTE pattern doesn't bind `y`
     }
 }
diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/compile-fail/issue-2848.rs
index e5503edfab5..f5e0c545bb5 100644
--- a/src/test/compile-fail/issue-2848.rs
+++ b/src/test/compile-fail/issue-2848.rs
@@ -19,7 +19,7 @@ mod bar {
 fn main() {
     use bar::foo::{alpha, charlie};
     match alpha {
-      alpha | beta => {} //~ ERROR variable `beta` from pattern #2 is not bound in pattern #1
-      charlie => {}
+      alpha | beta => {} //~  ERROR variable `beta` from pattern #2 is not bound in pattern #1
+      charlie => {}      //~| NOTE pattern doesn't bind `beta`
     }
 }
diff --git a/src/test/compile-fail/resolve-inconsistent-names.rs b/src/test/compile-fail/resolve-inconsistent-names.rs
index f7f3acd37d6..1e2541502ac 100644
--- a/src/test/compile-fail/resolve-inconsistent-names.rs
+++ b/src/test/compile-fail/resolve-inconsistent-names.rs
@@ -11,7 +11,9 @@
 fn main() {
     let y = 1;
     match y {
-       a | b => {} //~ ERROR variable `a` from pattern #1 is not bound in pattern #2
-       //~^ ERROR variable `b` from pattern #2 is not bound in pattern #1
+       a | b => {} //~  ERROR variable `a` from pattern #1 is not bound in pattern #2
+                   //~^ ERROR variable `b` from pattern #2 is not bound in pattern #1
+                   //~| NOTE pattern doesn't bind `a`
+                   //~| NOTE pattern doesn't bind `b`
     }
 }