1 // aux-build:variants.rs
4 use variants::NonExhaustiveVariants;
7 * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
8 * variants. See issue #44109 and PR 45394.
13 let variant_struct = NonExhaustiveVariants::Struct { field: 640 };
14 //~^ ERROR cannot create non-exhaustive variant
16 let variant_tuple = NonExhaustiveVariants::Tuple { 0: 640 };
17 //~^ ERROR cannot create non-exhaustive variant
19 match variant_struct {
20 NonExhaustiveVariants::Unit => "",
21 NonExhaustiveVariants::Tuple(fe_tpl) => "",
22 //~^ ERROR `..` required with variant marked as non-exhaustive
23 NonExhaustiveVariants::Struct { field } => ""
24 //~^ ERROR `..` required with variant marked as non-exhaustive