Wrong suggestion for slice patterns when using let-else statement · Issue #92069 · rust-lang/rust (original) (raw)
Given the following code: Playground link
#![feature(let_else)]
fn main() { let v = vec![1, 2, 3]; let [a, b, c] = v else { panic!(); }; }
The current output is:
error[E0529]: expected an array or slice, found `Vec<{integer}>`
--> src/main.rs:5:9
|
5 | let [a, b, c] = v else {
| ^^^^^^^^^ pattern cannot match with input type `Vec<{integer}>`
|
help: consider slicing here
|
5 ~ let [a, b, c] = v else {
6 + panic!();
7 + };[..]
|
The [..]
should be added to the v
, not after the whole statement.