Change:
<ins> error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:8:11 | LL |     match 0 { |           ^ pattern `_` not covered | = note: the matched value is of type `usize` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         1..=usize::MAX => (), LL ~         _ => todo!(), | error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:14:11 | LL |     match (0usize, 0usize) { |           ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered | = note: the matched value is of type `(usize, usize)` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         (1..=usize::MAX, 1..=usize::MAX) => (), LL ~         (_, _) => todo!(), | error[E0004]: non-exhaustive patterns: `(_, _)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:20:11 | LL |     match (0isize, 0usize) { |           ^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered | = note: the matched value is of type `(isize, usize)` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         (isize::MIN..=isize::MAX, 1..=usize::MAX) => (), LL ~         (_, _) => todo!(), | error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:27:11 | LL |     match Some(1usize) { |           ^^^^^^^^^^^^ pattern `Some(_)` not covered | note: `Option<usize>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL ::: $SRC_DIR/core/src/option.rs:LL:COL | = note: not covered = note: the matched value is of type `Option<usize>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         None => {}, LL +         Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:32:11 | LL |     match Some(4) { |           ^^^^^^^ pattern `Some(_)` not covered | note: `Option<usize>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL ::: $SRC_DIR/core/src/option.rs:LL:COL | = note: not covered = note: the matched value is of type `Option<usize>` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         None => (), LL ~         Some(_) => todo!(), | error[E0004]: non-exhaustive patterns: `Some(Some(Some(_)))` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:39:11 | LL |     match Some(Some(Some(0))) { |           ^^^^^^^^^^^^^^^^^^^ pattern `Some(Some(Some(_)))` not covered | note: `Option<Option<Option<usize>>>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL ::: $SRC_DIR/core/src/option.rs:LL:COL | = note: not covered | = note: not covered | = note: not covered = note: the matched value is of type `Option<Option<Option<usize>>>` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         None => (), LL ~         Some(Some(Some(_))) => todo!(), | error[E0004]: non-exhaustive patterns: `A { .. }` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:48:11 | LL |     match (A { a: 0usize }) { |           ^^^^^^^^^^^^^^^^^ pattern `A { .. }` not covered | note: `A<usize>` defined here --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:1:8 | LL | struct A<T> { |        ^ = note: the matched value is of type `A<usize>` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         A { a: 1..=usize::MAX } => (), LL ~         A { .. } => todo!(), | error[E0004]: non-exhaustive patterns: `B(_, _)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:54:11 | LL |     match B(0isize, 0usize) { |           ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered | note: `B<isize, usize>` defined here --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8 | LL | struct B<T, U>(T, U); |        ^ = note: the matched value is of type `B<isize, usize>` = note: `isize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         B(isize::MIN..=isize::MAX, 1..=usize::MAX) => (), LL ~         B(_, _) => todo!(), | error[E0004]: non-exhaustive patterns: `B(_, _)` not covered --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:62:11 | LL |     match B(0isize, 0usize) { |           ^^^^^^^^^^^^^^^^^ pattern `B(_, _)` not covered | note: `B<isize, usize>` defined here --> $DIR/issue-85222-types-containing-non-exhaustive-types.rs:5:8 | LL | struct B<T, U>(T, U); |        ^ = note: the matched value is of type `B<isize, usize>` = note: `usize` does not have a fixed maximum value, so a wildcard `_` is necessary to match exhaustively = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~         B(_, 1..=usize::MAX) => (), LL ~         B(_, _) => todo!(), | error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0004`. </ins>

Discussion:
Sorry about the long title :sweat_smile: Given the following code (): The current output is: Note how the first diagnostic, emitted when matching on a , contains additional information about why this exhaustive match does not pass the exhaustiveness check. Ideally, this information should be to the second diagnostic as well: modify labels: +A-exhaustiveness-checking +A-patterns +D-terse
Hm, even though has a different size on different architectures, should always be exhaustive, right? Then that code would be accepted, but the following would still error: We could have the error for this say "missing pattern: ", which would also work if there's a around it. That said, pretty sure what you describe also happens for enums too, and there we'll want to do what you suggest.
see also
I forgot this issue existed, but yeah this is a lint we want. I explained a bit about how this might be done in , if anyone wants to tackle this feel free to ping me