Just add a &: v[..] is a DST ([T], not &[T]). This is fine as long as we only access individual elements, but for rest patterns (..), that produce a slice - they will have to produce [T], too, and that is unsized. If you match against &[T], on the other hand, the rest pattern also gives &[T] (another possibility is to use ref - ref bc @ .., but I would not recommend that).
let [a, bc @ ..] = &str_vect[..];
Playground.
However, this fails with:
error[E0005]: refutable pattern in local binding: `&[]` not covered
--> src/main.rs:6:8
|
6 | let [a, bc @ ..] = &str_vect[..];
| ^^^^^^^^^^^^ pattern `&[]` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `&[&str]`
help: you might want to use `if let` to ignore the variant that isn't matched
|
6 | let (a, bc) = if let [a, bc @ ..] = &str_vect[..] { (a, bc) } else { todo!() };
| ++++++++++++++++ ++++++++++++++++++++++++++++
That is because any slice pattern except [..] is refutable - that is, may fail. What if str_vect (theoretically) has zero elements? We cannot bind the first element in that case! You need if let or match to handle that case.