File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -37,4 +37,5 @@ fn main() {
3737 v => { } ,
3838 _ => { } ,
3939 }
40+ if let [ & v] = & x[ ..] { } //~ ERROR mismatched types
4041}
Original file line number Diff line number Diff line change @@ -35,7 +35,19 @@ help: you can rely on match ergonomics and remove the explicit borrow
3535LL | v => {},
3636 | ^
3737
38- error: aborting due to 4 previous errors
38+ error[E0308]: mismatched types
39+ --> $DIR/match-ergonomics.rs:40:13
40+ |
41+ LL | if let [&v] = &x[..] {}
42+ | ^^
43+ | |
44+ | expected i32, found reference
45+ | help: you can probably remove the explicit borrow: `v`
46+ |
47+ = note: expected type `i32`
48+ found type `&_`
49+
50+ error: aborting due to 5 previous errors
3951
4052Some errors have detailed explanations: E0308, E0529.
4153For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments