miri: accept extern types in structs if they are the only field

This commit is contained in:
Ralf Jung 2018-11-04 11:23:34 +01:00
parent 6d69fe7a2f
commit e753d21051
3 changed files with 36 additions and 3 deletions

View file

@ -0,0 +1,21 @@
// compile-pass
// Test that we can handle newtypes wrapping extern types
#![feature(extern_types, const_transmute)]
extern "C" {
pub type ExternType;
}
unsafe impl Sync for ExternType {}
#[repr(transparent)]
pub struct Wrapper(ExternType);
static MAGIC_FFI_STATIC: u8 = 42;
pub static MAGIC_FFI_REF: &'static Wrapper = unsafe {
std::mem::transmute(&MAGIC_FFI_STATIC)
};
fn main() {}