miri: accept extern types in structs if they are the only field
This commit is contained in:
parent
6d69fe7a2f
commit
e753d21051
3 changed files with 36 additions and 3 deletions
21
src/test/ui/consts/const-eval/issue-55541.rs
Normal file
21
src/test/ui/consts/const-eval/issue-55541.rs
Normal 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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue