Closed
Description
Using unions currently causes panics, while mostly used for C FFI in Rust, there are couple of cases where they are used in Rust code, the main one being core::mem::MaybeUninit
.
Example
#![no_std]
#![feature(register_attr)]
#![register_attr(spirv)]
use spirv_std::glam::{ Vec4 };
use spirv_std::storage_class::{ Output };
union Foo { a: () }
#[allow(unused_attributes)]
#[spirv(fragment)]
pub fn main_fs(mut _output: Output<Vec4>)
{
let _a = Foo { a: () };
}
Error Message
thread 'rustc' panicked at 'assertion failed: `(left != right)`
left: `0`,
right: `0`: TyAndLayout {
ty: Foo,
layout: Layout {
fields: Union(
1,
),
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 0,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 0,
},
},
}', crates\rustc_codegen_spirv\src\abi.rs:638:13