Skip to content

Commit d9f60bc

Browse files
committed
add a test for rustc_layout(debug)
1 parent 55c2cf2 commit d9f60bc

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

src/test/ui/layout/debug.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(never_type, rustc_attrs)]
2+
#![crate_type = "lib"]
3+
4+
enum E { Foo, Bar(!, i32, i32) }
5+
6+
#[rustc_layout(debug)]
7+
type Test = E; //~ ERROR: layout debugging

src/test/ui/layout/debug.stderr

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
error: layout debugging: LayoutDetails {
2+
fields: Arbitrary {
3+
offsets: [
4+
Size {
5+
raw: 0,
6+
},
7+
],
8+
memory_index: [
9+
0,
10+
],
11+
},
12+
variants: Multiple {
13+
discr: Scalar {
14+
value: Int(
15+
I32,
16+
false,
17+
),
18+
valid_range: 0..=0,
19+
},
20+
discr_kind: Tag,
21+
discr_index: 0,
22+
variants: [
23+
LayoutDetails {
24+
fields: Arbitrary {
25+
offsets: [],
26+
memory_index: [],
27+
},
28+
variants: Single {
29+
index: 0,
30+
},
31+
abi: Aggregate {
32+
sized: true,
33+
},
34+
largest_niche: None,
35+
align: AbiAndPrefAlign {
36+
abi: Align {
37+
pow2: 0,
38+
},
39+
pref: Align {
40+
pow2: 3,
41+
},
42+
},
43+
size: Size {
44+
raw: 4,
45+
},
46+
},
47+
LayoutDetails {
48+
fields: Arbitrary {
49+
offsets: [
50+
Size {
51+
raw: 4,
52+
},
53+
Size {
54+
raw: 4,
55+
},
56+
Size {
57+
raw: 8,
58+
},
59+
],
60+
memory_index: [
61+
0,
62+
1,
63+
2,
64+
],
65+
},
66+
variants: Single {
67+
index: 1,
68+
},
69+
abi: Uninhabited,
70+
largest_niche: None,
71+
align: AbiAndPrefAlign {
72+
abi: Align {
73+
pow2: 2,
74+
},
75+
pref: Align {
76+
pow2: 3,
77+
},
78+
},
79+
size: Size {
80+
raw: 12,
81+
},
82+
},
83+
],
84+
},
85+
abi: Aggregate {
86+
sized: true,
87+
},
88+
largest_niche: Some(
89+
Niche {
90+
offset: Size {
91+
raw: 0,
92+
},
93+
scalar: Scalar {
94+
value: Int(
95+
I32,
96+
false,
97+
),
98+
valid_range: 0..=0,
99+
},
100+
},
101+
),
102+
align: AbiAndPrefAlign {
103+
abi: Align {
104+
pow2: 2,
105+
},
106+
pref: Align {
107+
pow2: 3,
108+
},
109+
},
110+
size: Size {
111+
raw: 12,
112+
},
113+
}
114+
--> $DIR/debug.rs:7:1
115+
|
116+
LL | type Test = E;
117+
| ^^^^^^^^^^^^^^
118+
119+
error: aborting due to previous error
120+

0 commit comments

Comments
 (0)