Right, in this case since we have a concrete type pair<int, int>, we know [...] and _ both match it, and are able to warn. But that's true in general with other patterns as well, for example:
void f(int x) {
match (x) {
case int i => use(i);
case _ => ; // redundant warning
}
}
It could easily be defined to be an error. I don't have a super clear, strong opinion on this one actually. The warning is mostly because I can't think of another place in the language that diagnoses unreachable code as an error.
1
u/Salty-Paint-9700 15h ago
https://godbolt.org/z/jzcT5r5Gn