1 // aux-build:match_non_exhaustive_lib.rs
3 /* The error message for non-exhaustive matches on non-local enums
4 * marked as non-exhaustive should mention the fact that the enum
5 * is marked as non-exhaustive (issue #85227).
8 // Ignore non_exhaustive in the same crate
12 extern crate match_non_exhaustive_lib;
13 use match_non_exhaustive_lib::{E1, E2};
15 fn foo() -> L {todo!()}
16 fn bar() -> (E1, E2) {todo!()}
20 // No error for enums defined in this crate
21 match l { L::A => (), L::B => () };
22 // (except if the match is already non-exhaustive)
23 match l { L::A => () };
24 //~^ ERROR: non-exhaustive patterns: `B` not covered [E0004]
26 // E1 is not visibly uninhabited from here
29 //~^ ERROR: non-exhaustive patterns: type `E1` is non-empty [E0004]
30 match e2 { E2::A => (), E2::B => () };
31 //~^ ERROR: non-exhaustive patterns: `_` not covered [E0004]