Skip to content

Vector pattern exhaustiveness #13482

Closed
Closed
@Boddlnagg

Description

@Boddlnagg

Compiling the following code (with current master) results in "error: non-exhaustive patterns: vectors of length 2 not covered". I don't know if this ought to be valid, but at least the error-message is wrong, because obviously there is a match-branch for vectors of length 2.

fn main() {
  let x = [1,2];
  let y = match x {
    [] => None,
    [a,_] => Some(a)
  };
  println!("{}", y);            
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions