Closed
Description
fn main() {
let [] = vec![];
}
<anon>:3:9: 3:11 error: mismatched types: expected `collections::vec::Vec<<generic #3>>`, found a vector pattern
<anon>:3 let [] = vec![];
^~
error: aborting due to previous error
This is very confusing because they only work with slices and arrays, and it's not rare to try to match on a Vec
, drawing a false link between the pattern and the Vec
type.
They should be called "array patterns" or "slice patterns". (Tagging as easy because it should be a matter of git grep 'vector pattern'
and fixing all the locations: it could probably be done via sed
!)