downcast to 1 turned ScalarPair layout into non-scalar layout: TyAndLayout {
ty: std::option::Option<*mut std::ffi::c_void>,
layout: Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 0,
},
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I64,
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 {
pow2: 0,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 8,
},
},
Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 8,
},
],
memory_index: [
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I64,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Pointer,
valid_range: 0..=18446744073709551615,
},
),
largest_niche: Some(
Niche {
offset: Size {
raw: 0,
},
value: Int(
I64,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
} to TyAndLayout {
ty: std::option::Option<*mut std::ffi::c_void>,
layout: Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 8,
},
],
memory_index: [
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
}
I noticed this while working on #96185: I added the following sanity check in Miri's
operand_downcast:This assertion indeed fails. When downcasting
std::option::Option<*mut std::ffi::c_void>to variant 1, the ABI changes fromScalarPairtoAggegreate.Details
Cc @oli-obk @erikdesjardins