You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
fnmain(){let x = [1,2];let y = match x {[] => None,[a,_] => Some(a)};println!("{}", y);}
The text was updated successfully, but these errors were encountered:
The variable x is an array with a static length of 2 (in Rust's syntax it would be [T, ..2]), whereas the first pattern has type [T, ..0]. It wouldn't make much sense for it to be valid. The error message is indeed incorrect, however. I believe the type error is making it past the type checker before it gets to the match checker, which is the culprit for creating that very confusing error message. I'm new to the Rust compiler, though, so I'm not sure on that last part.
Nice find! If this is still open tomorrow I'll take a look at it more thoroughly.
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.
The text was updated successfully, but these errors were encountered: