]> git.lizzy.rs Git - rust.git/blob - src/test/ui/layout/hexagon-enum.rs
Rollup merge of #97317 - GuillaumeGomez:gui-settings-text-click, r=jsha
[rust.git] / src / test / ui / layout / hexagon-enum.rs
1 // compile-flags: --target hexagon-unknown-linux-musl
2 // needs-llvm-components: hexagon
3 //
4 // Verify that the hexagon targets implement the repr(C) for enums correctly.
5 //
6 // See #82100
7 #![feature(never_type, rustc_attrs, no_core, lang_items)]
8 #![crate_type = "lib"]
9 #![no_core]
10
11 #[lang="sized"]
12 trait Sized {}
13
14 #[rustc_layout(debug)]
15 #[repr(C)]
16 enum A { Apple } //~ ERROR: layout_of
17
18 #[rustc_layout(debug)]
19 #[repr(C)]
20 enum B { Banana = 255, } //~ ERROR: layout_of
21
22 #[rustc_layout(debug)]
23 #[repr(C)]
24 enum C { Chaenomeles = 256, } //~ ERROR: layout_of
25
26 #[rustc_layout(debug)]
27 #[repr(C)]
28 enum P { Peach = 0x1000_0000isize, } //~ ERROR: layout_of
29
30 const TANGERINE: usize = 0x8100_0000; // hack to get negative numbers without negation operator!
31
32 #[rustc_layout(debug)]
33 #[repr(C)]
34 enum T { Tangerine = TANGERINE as isize } //~ ERROR: layout_of