about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugene R Gonzalez <gene@teamtiki.us>2016-09-01 22:35:25 -0400
committerEugene R Gonzalez <gene@teamtiki.us>2016-09-01 22:35:25 -0400
commit7f95bb0dbd70e838d7cc12520135b08853c8b192 (patch)
tree318ef25c96a069a012cdc6ad24860c9b3015621b
parent147371f58f1a99e32524d61af1d86b2e1e0a503b (diff)
downloadrust-7f95bb0dbd70e838d7cc12520135b08853c8b192.tar.gz
rust-7f95bb0dbd70e838d7cc12520135b08853c8b192.zip
Fixed E0529's label and unit test
-rw-r--r--src/librustc_typeck/check/_match.rs5
-rw-r--r--src/test/compile-fail/E0529.rs4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index 225468cb9f4..1027a3207f0 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -270,7 +270,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                     _ => {}
                                 }
                             }
-                            err.emit();
+
+                            err.span_label( pat.span,
+                                &format!("pattern cannot match with input type `{}`", expected_ty)
+                            ).emit();
                         }
                         (tcx.types.err, tcx.types.err)
                     }
diff --git a/src/test/compile-fail/E0529.rs b/src/test/compile-fail/E0529.rs
index 488fe7c7763..18d3e68816a 100644
--- a/src/test/compile-fail/E0529.rs
+++ b/src/test/compile-fail/E0529.rs
@@ -13,7 +13,9 @@
 fn main() {
     let r: f32 = 1.0;
     match r {
-        [a, b] => { //~ ERROR E0529
+        [a, b] => {
+        //~^ ERROR E0529
+        //~| NOTE pattern cannot match with input type `f32`
         }
     }
 }