mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-21 22:34:34 +00:00
Add support for zero sized types
This commit is contained in:
parent
b0328ed454
commit
03f89e8ba6
@ -412,6 +412,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
if field_ty_kind
|
||||
.sizeof(self)
|
||||
.map_or(true, |size| offset_in_field < size)
|
||||
// If the field is a zero sized type, check the type to
|
||||
// get the correct entry
|
||||
|| offset_in_field == Size::ZERO && leaf_ty == field_ty
|
||||
{
|
||||
Some((i, field_ty, field_ty_kind, offset_in_field))
|
||||
} else {
|
||||
|
18
tests/ui/lang/core/ref/zst_member_ref_arg.rs
Normal file
18
tests/ui/lang/core/ref/zst_member_ref_arg.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// build-pass
|
||||
|
||||
use spirv_std as _;
|
||||
struct A;
|
||||
struct B;
|
||||
|
||||
struct S {
|
||||
x: A,
|
||||
y: B,
|
||||
}
|
||||
|
||||
fn f(x: &B) {}
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
let s = S { x: A, y: B };
|
||||
f(&s.y);
|
||||
}
|
Loading…
Reference in New Issue
Block a user