about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-04-29 20:58:29 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-04-29 20:58:29 -0700
commit6068478d56a05ab1aa4d9ad87046e1d5d47afd7f (patch)
tree748f60f67b40555c3a96ff63d7d9fbded815f182
parent14ca95066579f4ec3761fa171e9c9c6d7bd80ccb (diff)
downloadrust-6068478d56a05ab1aa4d9ad87046e1d5d47afd7f.tar.gz
rust-6068478d56a05ab1aa4d9ad87046e1d5d47afd7f.zip
Add if let test
-rw-r--r--src/test/ui/suggestions/match-ergonomics.rs1
-rw-r--r--src/test/ui/suggestions/match-ergonomics.stderr14
2 files changed, 14 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/match-ergonomics.rs b/src/test/ui/suggestions/match-ergonomics.rs
index d75f8363cd2..c4fc01469bf 100644
--- a/src/test/ui/suggestions/match-ergonomics.rs
+++ b/src/test/ui/suggestions/match-ergonomics.rs
@@ -37,4 +37,5 @@ fn main() {
         v => {},
         _ => {},
     }
+    if let [&v] = &x[..] {} //~ ERROR mismatched types
 }
diff --git a/src/test/ui/suggestions/match-ergonomics.stderr b/src/test/ui/suggestions/match-ergonomics.stderr
index a064e2485ff..9915eeb34fa 100644
--- a/src/test/ui/suggestions/match-ergonomics.stderr
+++ b/src/test/ui/suggestions/match-ergonomics.stderr
@@ -35,7 +35,19 @@ help: you can rely on match ergonomics and remove the explicit borrow
 LL |         v => {},
    |         ^
 
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+  --> $DIR/match-ergonomics.rs:40:13
+   |
+LL |     if let [&v] = &x[..] {}
+   |             ^^
+   |             |
+   |             expected i32, found reference
+   |             help: you can probably remove the explicit borrow: `v`
+   |
+   = note: expected type `i32`
+              found type `&_`
+
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0308, E0529.
 For more information about an error, try `rustc --explain E0308`.