I was trying to write an exhaustive match statement over a (u32, usize) tuple in rust, here is a minimal example:
fn test(x: u32, y: usize) {
match (x, y) {
(0, 0) => todo!(),
(0, 1..) => todo!(),
(1.., 0) => todo!(),
(1.., 1..) => todo!(),
}
}
The compiler complains that this is non-exhaustive and is missing this case:
(0_u32, _) | (1_u32..=u32::MAX, _) => todo!()
Strangely this works with (u32, u32) tuples, but not a heterogeneous (u32, usize) tuple. Is this a compiler problem, or am I really missing an edge case?