]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/enum-size-variance.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / run-pass / enum-size-variance.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 //
11 // ignore-pretty
12
13 #![deny(enum_size_variance)]
14 #![allow(dead_code)]
15
16 enum Enum1 { }
17
18 enum Enum2 { A, B, C }
19
20 enum Enum3 { D(isize), E, F }
21
22 enum Enum4 { H(isize), I(isize), J }
23
24 enum Enum5 { //~ ERROR three times larger
25     L(isize, isize, isize, isize), //~ NOTE this variant is the largest
26     M(isize),
27     N
28 }
29
30 enum Enum6<T, U> {
31     O(T),
32     P(U),
33     Q(isize)
34 }
35
36 #[allow(enum_size_variance)]
37 enum Enum7 {
38     R(isize, isize, isize, isize),
39     S(isize),
40     T
41 }
42 pub fn main() { }