-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #56059 - alexcrichton:fix-tests, r=sfackler
Increase `Duration` approximate equal threshold to 1us Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes #56034
- Loading branch information
Showing
4 changed files
with
54 additions
and
5 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
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,27 @@ | ||
// compile-pass | ||
|
||
// Test that we can handle newtypes wrapping extern types | ||
|
||
#![feature(extern_types, const_transmute)] | ||
|
||
use std::marker::PhantomData; | ||
|
||
extern "C" { | ||
pub type ExternType; | ||
} | ||
unsafe impl Sync for ExternType {} | ||
static MAGIC_FFI_STATIC: u8 = 42; | ||
|
||
#[repr(transparent)] | ||
pub struct Wrapper(ExternType); | ||
pub static MAGIC_FFI_REF: &'static Wrapper = unsafe { | ||
std::mem::transmute(&MAGIC_FFI_STATIC) | ||
}; | ||
|
||
#[repr(transparent)] | ||
pub struct Wrapper2(PhantomData<Vec<i32>>, ExternType); | ||
pub static MAGIC_FFI_REF2: &'static Wrapper2 = unsafe { | ||
std::mem::transmute(&MAGIC_FFI_STATIC) | ||
}; | ||
|
||
fn main() {} |