Skip to content

Commit

Permalink
add test for extern type
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdesjardins committed Mar 7, 2024
1 parent 8ebd307 commit e349900
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/codegen/dst-offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#![crate_type = "lib"]

#![feature(extern_types)]

use std::ptr::addr_of;

// Hack to get the correct type for usize
Expand Down Expand Up @@ -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
}

0 comments on commit e349900

Please sign in to comment.