2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2018-08-31 15:02:01 +02:00
|
|
|
#![allow(deprecated)]
|
|
|
|
|
|
2015-01-30 09:43:11 +02:00
|
|
|
use std::mem;
|
|
|
|
|
|
2015-10-18 19:03:42 +03:00
|
|
|
#[derive(PartialEq, Debug)]
|
2015-01-30 09:43:11 +02:00
|
|
|
enum Foo {
|
|
|
|
|
A(u32),
|
|
|
|
|
Bar([u16; 4]),
|
|
|
|
|
C
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NOTE(eddyb) Don't make this a const, needs to be a static
|
2023-09-28 16:15:41 +08:00
|
|
|
// so it is always instantiated as an LLVM constant value.
|
2015-01-30 09:43:11 +02:00
|
|
|
static FOO: Foo = Foo::C;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
assert_eq!(FOO, Foo::C);
|
|
|
|
|
assert_eq!(mem::size_of::<Foo>(), 12);
|
2025-06-12 13:44:19 +02:00
|
|
|
assert_eq!(mem::align_of::<Foo>(), 4);
|
2015-01-30 09:43:11 +02:00
|
|
|
}
|