File tree 2 files changed +47
-0
lines changed
src/test/ui/print_type_sizes
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2018 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
+ // compile-flags: -Z print-type-sizes
12
+ // compile-pass
13
+
14
+ // This test makes sure that the tag is not grown for `repr(C)` or `repr(u8)`
15
+ // variants (see https://github.com/rust-lang/rust/issues/50098 for the original bug).
16
+
17
+ #![ feature( start) ]
18
+ #![ allow( dead_code) ]
19
+
20
+ #[ repr( C , u8 ) ]
21
+ enum ReprCu8 {
22
+ A ( u16 ) ,
23
+ B ,
24
+ }
25
+
26
+ #[ repr( u8 ) ]
27
+ enum Repru8 {
28
+ A ( u16 ) ,
29
+ B ,
30
+ }
31
+
32
+ #[ start]
33
+ fn start ( _: isize , _: * const * const u8 ) -> isize {
34
+ 0
35
+ }
Original file line number Diff line number Diff line change
1
+ print-type-size type: `ReprCu8`: 4 bytes, alignment: 2 bytes
2
+ print-type-size discriminant: 1 bytes
3
+ print-type-size variant `A`: 3 bytes
4
+ print-type-size padding: 1 bytes
5
+ print-type-size field `.0`: 2 bytes, alignment: 2 bytes
6
+ print-type-size variant `B`: 1 bytes
7
+ print-type-size type: `Repru8`: 4 bytes, alignment: 2 bytes
8
+ print-type-size discriminant: 1 bytes
9
+ print-type-size variant `A`: 3 bytes
10
+ print-type-size padding: 1 bytes
11
+ print-type-size field `.0`: 2 bytes, alignment: 2 bytes
12
+ print-type-size variant `B`: 0 bytes
You can’t perform that action at this time.
0 commit comments