Closed
Description
When matching on non-sum types we tell people they should add a new fallback case
error[E0004]: non-exhaustive patterns: `(&_, _)` not covered
--> src/main.rs:4:11
|
4 | match (a, b) {
| ^^^^^^ pattern `(&_, _)` not covered
|
= note: the matched value is of type `(&str, &str)`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
6 ~ ("c", "d") => {}
7 + (&_, _) => todo!()
|
but we should go further and check whether the fallback is because of a free-form non-sum type (namely, not an enum
) and explain that, for example, &str can hold any arbitrary string and match needs an arm to account for it.