Add if let test

This commit is contained in:
Esteban Küber 2019-04-29 20:58:29 -07:00
parent 14ca950665
commit 6068478d56
2 changed files with 14 additions and 1 deletions

View File

@ -37,4 +37,5 @@ fn main() {
v => {},
_ => {},
}
if let [&v] = &x[..] {} //~ ERROR mismatched types
}

View File

@ -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`.