]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2008-non-exhaustive/variants.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / rfc-2008-non-exhaustive / variants.rs
1 // aux-build:variants.rs
2 extern crate variants;
3
4 use variants::NonExhaustiveVariants;
5
6 /*
7  * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for
8  * variants. See issue #44109 and PR 45394.
9  */
10 // ignore-test
11
12 fn main() {
13     let variant_struct = NonExhaustiveVariants::Struct { field: 640 };
14     //~^ ERROR cannot create non-exhaustive variant
15
16     let variant_tuple = NonExhaustiveVariants::Tuple { 0: 640 };
17     //~^ ERROR cannot create non-exhaustive variant
18
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
25     };
26 }