-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
miri: accept extern types in structs if they are the only field
- Loading branch information
Showing
3 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |