Closed
Description
The following program prints 102. Commenting out the match arm for either 100 or 102 causes the correct value (101) to be printed. I believe the first and third cases are being merged as they have the same form (but different guards), ruining the priority.
#![feature(slice_patterns)]
fn main() {
let v = vec![1, 2];
println!("{}", test(&v));
}
fn test(a: &[u64]) -> u64 {
match a {
[a, b ..] if a == 3 => 100,
[a, b] if a == 1 => 101,
[a, b ..] => 102,
_ => 103
}
}
// rustc 1.1.0-dev (69e47c77b 2015-04-23) (built 2015-04-23)
Metadata
Metadata
Assignees
Labels
No labels