mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
extra paranoid mode
This commit is contained in:
parent
a733b876f7
commit
3f99ad175a
@ -11,6 +11,7 @@ const DANGLING: NonNull<u32> = NonNull::dangling();
|
||||
const CASTED: NonNull<u32> = NonNull::cast(NonNull::<i32>::dangling());
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(DANGLING, b(NonNull::dangling)());
|
||||
assert_eq!(CASTED, b(NonNull::dangling)());
|
||||
// Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
|
||||
assert_eq!(DANGLING, b::<fn() -> _>(NonNull::dangling)());
|
||||
assert_eq!(CASTED, b::<fn() -> _>(NonNull::dangling)());
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ use std::ptr::Unique;
|
||||
const PTR: *mut u32 = Unique::empty().as_ptr();
|
||||
|
||||
pub fn main() {
|
||||
assert_eq!(PTR, b(Unique::<u32>::empty)().as_ptr());
|
||||
// Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
|
||||
assert_eq!(PTR, b::<fn() -> _>(Unique::<u32>::empty)().as_ptr());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user