add test for extern type

This commit is contained in:
Erik Desjardins 2024-03-06 19:53:45 -05:00
parent 8ebd307d2a
commit e349900339

View File

@ -4,6 +4,8 @@
#![crate_type = "lib"]
#![feature(extern_types)]
use std::ptr::addr_of;
// Hack to get the correct type for usize
@ -67,3 +69,16 @@ pub fn packed_dst_slice_offset(s: &PackedDstSlice) -> *const [u16] {
// CHECK-NEXT: ret
addr_of!(s.z)
}
extern {
pub type Extern;
}
// CHECK-LABEL: @dst_extern
#[no_mangle]
pub fn dst_extern(s: &Dst<Extern>) -> &Extern {
// Computing the alignment of an extern type is currently unsupported and just panics.
// CHECK: call void @{{.+}}panic
&s.z
}