Closed
Description
The following code
fn main() {
let a = vec![16u8];
match (a.as_slice(), "a") {
([8], "a")
|([8, _], "a") => {},
([16], "a")
|([16, _], "a") => { println!("matched") },
// (_, _) => fail!(), // Fails if this line is used
_ => fail!() // prints matched if this line is used
}
}
fails, if the comment is swapped between the two last lines.
But (_, _) only matches when I use |([8, _], "a")
in the first pattern and if I use a [16]
instead of [8]
as a value for a. I don't think this behaves as intended.
Metadata
Metadata
Assignees
Labels
No labels