1 // aux-build:variants.rs
5 use variants::NonExhaustiveVariants;
8 let variant_struct = NonExhaustiveVariants::Struct { field: 640 };
9 //~^ ERROR cannot create non-exhaustive variant
11 let variant_tuple = NonExhaustiveVariants::Tuple(640);
12 //~^ ERROR tuple variant `Tuple` is private [E0603]
14 let variant_unit = NonExhaustiveVariants::Unit;
15 //~^ ERROR unit variant `Unit` is private [E0603]
17 match variant_struct {
18 NonExhaustiveVariants::Unit => "",
19 //~^ ERROR unit variant `Unit` is private [E0603]
20 NonExhaustiveVariants::Tuple(fe_tpl) => "",
21 //~^ ERROR tuple variant `Tuple` is private [E0603]
22 NonExhaustiveVariants::Struct { field } => ""
23 //~^ ERROR `..` required with variant marked as non-exhaustive
26 if let NonExhaustiveVariants::Tuple(fe_tpl) = variant_struct {
27 //~^ ERROR tuple variant `Tuple` is private [E0603]
30 if let NonExhaustiveVariants::Struct { field } = variant_struct {
31 //~^ ERROR `..` required with variant marked as non-exhaustive