Skip to content

[...] patterns are confusingly called "vector patterns" in error messages #17765

Closed
@huonw

Description

@huonw
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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions