Rollup merge of #99973 - RalfJung:layout-things, r=eddyb

Layout things

These two commits are pretty independent, but didn't seem worth doing individual PRs for:
- Always check that size is a multiple of align, even without debug assertions
- Change Layout debug printing to put `variants` last, since it often huge and not usually the part we are most interested in

Cc `@eddyb`
This commit is contained in:
Matthias Krüger 2022-07-31 23:39:42 +02:00 committed by GitHub
commit 549463f114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1076 additions and 1071 deletions

View File

@ -232,6 +232,10 @@ fn sanity_check_layout<'tcx>(
assert!(layout.abi.is_uninhabited());
}
if layout.size.bytes() % layout.align.abi.bytes() != 0 {
bug!("size is not a multiple of align, in the following layout:\n{layout:#?}");
}
if cfg!(debug_assertions) {
fn check_layout_abi<'tcx>(tcx: TyCtxt<'tcx>, layout: Layout<'tcx>) {
match layout.abi() {

View File

@ -1279,13 +1279,14 @@ impl<'a> fmt::Debug for LayoutS<'a> {
// This is how `Layout` used to print before it become
// `Interned<LayoutS>`. We print it like this to avoid having to update
// expected output in a lot of tests.
let LayoutS { size, align, abi, fields, largest_niche, variants } = self;
f.debug_struct("Layout")
.field("fields", &self.fields)
.field("variants", &self.variants)
.field("abi", &self.abi)
.field("largest_niche", &self.largest_niche)
.field("align", &self.align)
.field("size", &self.size)
.field("size", size)
.field("align", align)
.field("abi", abi)
.field("fields", fields)
.field("largest_niche", largest_niche)
.field("variants", variants)
.finish()
}
}

View File

@ -1,4 +1,12 @@
error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +15,16 @@ error: layout_of(E) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,24 +37,30 @@ error: layout_of(E) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Uninhabited,
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -49,37 +73,13 @@ error: layout_of(E) = Layout {
2,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Uninhabited,
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(12 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(12 bytes),
}
--> $DIR/debug.rs:6:1
|
@ -87,6 +87,27 @@ LL | enum E { Foo, Bar(!, i32, i32) }
| ^^^^^^
error: layout_of(S) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -99,31 +120,10 @@ error: layout_of(S) = Layout {
2,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/debug.rs:9:1
|
@ -131,21 +131,21 @@ LL | struct S { f1: i32, f2: (), f3: i32 }
| ^^^^^^^^
error: layout_of(U) = Layout {
fields: Union(
2,
),
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
abi: Aggregate {
sized: true,
},
fields: Union(
2,
),
largest_niche: None,
variants: Single {
index: 0,
},
}
--> $DIR/debug.rs:12:1
|
@ -153,6 +153,27 @@ LL | union U { f1: (i32, i32), f3: i32 }
| ^^^^^^^
error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -161,6 +182,16 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -173,6 +204,27 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -181,9 +233,17 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -200,14 +260,6 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -216,65 +268,13 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/debug.rs:15:1
|
@ -282,9 +282,10 @@ LL | type Test = Result<i32, i32>;
| ^^^^^^^^^
error: layout_of(i32) = Layout {
fields: Primitive,
variants: Single {
index: 0,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Scalar(
Initialized {
@ -295,12 +296,11 @@ error: layout_of(i32) = Layout {
valid_range: 0..=4294967295,
},
),
fields: Primitive,
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 0,
},
size: Size(4 bytes),
}
--> $DIR/debug.rs:18:1
|

View File

@ -1,4 +1,18 @@
error: layout_of(A) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +21,16 @@ error: layout_of(A) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,49 +43,25 @@ error: layout_of(A) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
}
--> $DIR/hexagon-enum.rs:16:1
|
@ -69,6 +69,20 @@ LL | enum A { Apple }
| ^^^^^^
error: layout_of(B) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -77,6 +91,16 @@ error: layout_of(B) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -89,49 +113,25 @@ error: layout_of(B) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
}
--> $DIR/hexagon-enum.rs:20:1
|
@ -139,6 +139,20 @@ LL | enum B { Banana = 255, }
| ^^^^^^
error: layout_of(C) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -147,6 +161,16 @@ error: layout_of(C) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -159,49 +183,25 @@ error: layout_of(C) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
size: Size(2 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
size: Size(2 bytes),
}
--> $DIR/hexagon-enum.rs:24:1
|
@ -209,6 +209,20 @@ LL | enum C { Chaenomeles = 256, }
| ^^^^^^
error: layout_of(P) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -217,6 +231,16 @@ error: layout_of(P) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -229,49 +253,25 @@ error: layout_of(P) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/hexagon-enum.rs:28:1
|
@ -279,6 +279,20 @@ LL | enum P { Peach = 0x1000_0000isize, }
| ^^^^^^
error: layout_of(T) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -287,6 +301,16 @@ error: layout_of(T) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -299,49 +323,25 @@ error: layout_of(T) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/hexagon-enum.rs:34:1
|

View File

@ -1,76 +1,8 @@
error: layout_of(MissingPayloadField) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
],
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -87,6 +19,14 @@ error: layout_of(MissingPayloadField) = Layout {
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -97,26 +37,6 @@ error: layout_of(MissingPayloadField) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
|
LL | pub enum MissingPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadField) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -129,6 +49,26 @@ error: layout_of(CommonPayloadField) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -137,69 +77,43 @@ error: layout_of(CommonPayloadField) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
},
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
],
},
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
|
LL | pub enum MissingPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadField) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -216,6 +130,14 @@ error: layout_of(CommonPayloadField) = Layout {
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -226,26 +148,6 @@ error: layout_of(CommonPayloadField) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
|
LL | pub enum CommonPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -258,6 +160,27 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -266,9 +189,17 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -277,21 +208,14 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
),
valid_range: 0..=1,
},
Union {
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -300,33 +224,25 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
],
},
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
|
LL | pub enum CommonPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -342,6 +258,14 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -352,11 +276,87 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
],
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1
|
@ -364,6 +364,26 @@ LL | pub enum CommonPayloadFieldIsMaybeUninit {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(NicheFirst) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -372,6 +392,16 @@ error: layout_of(NicheFirst) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -388,18 +418,10 @@ error: layout_of(NicheFirst) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
variants: Single {
index: 0,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -417,6 +439,16 @@ error: layout_of(NicheFirst) = Layout {
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -427,80 +459,48 @@ error: layout_of(NicheFirst) = Layout {
valid_range: 0..=2,
},
),
variants: Single {
index: 0,
},
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1
|
@ -508,6 +508,26 @@ LL | pub enum NicheFirst {
| ^^^^^^^^^^^^^^^^^^^
error: layout_of(NicheSecond) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Union {
value: Int(
I8,
false,
),
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -516,6 +536,16 @@ error: layout_of(NicheSecond) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -532,18 +562,10 @@ error: layout_of(NicheSecond) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
variants: Single {
index: 0,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -561,6 +583,16 @@ error: layout_of(NicheSecond) = Layout {
valid_range: 0..=2,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -571,80 +603,48 @@ error: layout_of(NicheSecond) = Layout {
valid_range: 0..=2,
},
),
variants: Single {
index: 0,
},
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
],
},
abi: ScalarPair(
Union {
value: Int(
I8,
false,
),
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
largest_niche: Some(
Niche {
offset: Size(1 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1
|

View File

@ -1,4 +1,12 @@
error: layout_of(Aligned1) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,58 +15,6 @@ error: layout_of(Aligned1) = Layout {
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -69,26 +25,6 @@ error: layout_of(Aligned1) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:8:1
|
LL | pub enum Aligned1 {
| ^^^^^^^^^^^^^^^^^
error: layout_of(Aligned2) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -101,43 +37,55 @@ error: layout_of(Aligned2) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
],
},
}
--> $DIR/issue-96185-overaligned-enum.rs:8:1
|
LL | pub enum Aligned1 {
| ^^^^^^^^^^^^^^^^^
error: layout_of(Aligned2) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Scalar(
Initialized {
value: Int(
@ -147,6 +95,14 @@ error: layout_of(Aligned2) = Layout {
valid_range: 0..=1,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -157,11 +113,55 @@ error: layout_of(Aligned2) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
],
},
size: Size(1 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:16:1
|

View File

@ -1,4 +1,18 @@
error: layout_of(A) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +21,16 @@ error: layout_of(A) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,49 +43,25 @@ error: layout_of(A) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
}
--> $DIR/thumb-enum.rs:16:1
|
@ -69,6 +69,20 @@ LL | enum A { Apple }
| ^^^^^^
error: layout_of(B) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -77,6 +91,16 @@ error: layout_of(B) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -89,49 +113,25 @@ error: layout_of(B) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
}
--> $DIR/thumb-enum.rs:20:1
|
@ -139,6 +139,20 @@ LL | enum B { Banana = 255, }
| ^^^^^^
error: layout_of(C) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -147,6 +161,16 @@ error: layout_of(C) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -159,49 +183,25 @@ error: layout_of(C) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
size: Size(2 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
size: Size(2 bytes),
}
--> $DIR/thumb-enum.rs:24:1
|
@ -209,6 +209,20 @@ LL | enum C { Chaenomeles = 256, }
| ^^^^^^
error: layout_of(P) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -217,6 +231,16 @@ error: layout_of(P) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -229,49 +253,25 @@ error: layout_of(P) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/thumb-enum.rs:28:1
|
@ -279,6 +279,20 @@ LL | enum P { Peach = 0x1000_0000isize, }
| ^^^^^^
error: layout_of(T) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -287,6 +301,16 @@ error: layout_of(T) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -299,49 +323,25 @@ error: layout_of(T) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/thumb-enum.rs:34:1
|

View File

@ -1,4 +1,12 @@
error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +15,16 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,6 +37,14 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -27,20 +53,20 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -49,12 +75,6 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -65,32 +85,12 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:13:1
|
@ -98,6 +98,14 @@ LL | type AlignedResult = Result<[u32; 0], bool>;
| ^^^^^^^^^^^^^^^^^^
error: layout_of(MultipleAlignments) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -106,6 +114,16 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=2,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -118,6 +136,14 @@ error: layout_of(MultipleAlignments) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(2 bytes),
@ -126,20 +152,20 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -148,20 +174,20 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -170,12 +196,6 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -186,32 +206,12 @@ error: layout_of(MultipleAlignments) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 2,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=2,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:21:1
|
@ -219,6 +219,14 @@ LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -227,6 +235,16 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -239,6 +257,14 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
tag_field: 0,
variants: [
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -247,20 +273,20 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(3 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -269,12 +295,6 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -285,32 +305,12 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
valid_range: 1..=65535,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(3 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:37:1
|
@ -318,6 +318,14 @@ LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -326,6 +334,16 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -342,28 +360,14 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -372,12 +376,28 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -388,32 +408,12 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:44:1
|