]> git.proxmox.com Git - rustc.git/blob - tests/ui/layout/debug.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / tests / ui / layout / debug.rs
1 // normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"
2 #![feature(never_type, rustc_attrs, type_alias_impl_trait, repr_simd)]
3 #![crate_type = "lib"]
4
5 #[rustc_layout(debug)]
6 #[derive(Copy, Clone)]
7 enum E { Foo, Bar(!, i32, i32) } //~ ERROR: layout_of
8
9 #[rustc_layout(debug)]
10 struct S { f1: i32, f2: (), f3: i32 } //~ ERROR: layout_of
11
12 #[rustc_layout(debug)]
13 union U { f1: (i32, i32), f3: i32 } //~ ERROR: layout_of
14
15 #[rustc_layout(debug)]
16 type Test = Result<i32, i32>; //~ ERROR: layout_of
17
18 #[rustc_layout(debug)]
19 type T = impl std::fmt::Debug; //~ ERROR: layout_of
20 fn f() -> T {
21 0i32
22 }
23
24 #[rustc_layout(debug)]
25 pub union V { //~ ERROR: layout_of
26 a: [u16; 0],
27 b: u8,
28 }
29
30 #[rustc_layout(debug)]
31 pub union W { //~ ERROR: layout_of
32 b: u8,
33 a: [u16; 0],
34 }
35
36 #[rustc_layout(debug)]
37 pub union Y { //~ ERROR: layout_of
38 b: [u8; 0],
39 a: [u16; 0],
40 }
41
42 #[rustc_layout(debug)]
43 #[repr(packed(1))]
44 union P1 { x: u32 } //~ ERROR: layout_of
45
46 #[rustc_layout(debug)]
47 #[repr(packed(1))]
48 union P2 { x: (u32, u32) } //~ ERROR: layout_of
49
50 #[repr(simd)]
51 #[derive(Copy, Clone)]
52 struct F32x4(f32, f32, f32, f32);
53
54 #[rustc_layout(debug)]
55 #[repr(packed(1))]
56 union P3 { x: F32x4 } //~ ERROR: layout_of
57
58 #[rustc_layout(debug)]
59 #[repr(packed(1))]
60 union P4 { x: E } //~ ERROR: layout_of
61
62 #[rustc_layout(debug)]
63 #[repr(packed(1))]
64 union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
65
66 #[rustc_layout(debug)]
67 type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
68
69 #[rustc_layout(debug)]
70 const C: () = (); //~ ERROR: can only be applied to
71
72 impl S {
73 #[rustc_layout(debug)]
74 const C: () = (); //~ ERROR: can only be applied to
75 }
76
77 #[rustc_layout(debug)]
78 type Impossible = (str, str); //~ ERROR: cannot be known at compilation time