summaryrefslogtreecommitdiffstats
path: root/tests/ui/layout/thumb-enum.rs
blob: 3b43b1b83fa6e039f4185587a132972c5fa8d63d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// compile-flags: --target thumbv8m.main-none-eabihf
// needs-llvm-components: arm
//
// Verify that thumb targets implement the repr(C) for enums correctly.
//
// See #87917
#![feature(never_type, rustc_attrs, no_core, lang_items)]
#![crate_type = "lib"]
#![no_core]

#[lang="sized"]
trait Sized {}

#[rustc_layout(debug)]
#[repr(C)]
enum A { Apple } //~ ERROR: layout_of

#[rustc_layout(debug)]
#[repr(C)]
enum B { Banana = 255, } //~ ERROR: layout_of

#[rustc_layout(debug)]
#[repr(C)]
enum C { Chaenomeles = 256, } //~ ERROR: layout_of

#[rustc_layout(debug)]
#[repr(C)]
enum P { Peach = 0x1000_0000isize, } //~ ERROR: layout_of

const TANGERINE: usize = 0x8100_0000; // hack to get negative numbers without negation operator!

#[rustc_layout(debug)]
#[repr(C)]
enum T { Tangerine = TANGERINE as isize } //~ ERROR: layout_of