extra paranoid mode
This commit is contained in:
parent
a733b876f7
commit
3f99ad175a
2 changed files with 5 additions and 3 deletions
|
@ -11,6 +11,7 @@ const DANGLING: NonNull<u32> = NonNull::dangling();
|
||||||
const CASTED: NonNull<u32> = NonNull::cast(NonNull::<i32>::dangling());
|
const CASTED: NonNull<u32> = NonNull::cast(NonNull::<i32>::dangling());
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
assert_eq!(DANGLING, b(NonNull::dangling)());
|
// Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
|
||||||
assert_eq!(CASTED, b(NonNull::dangling)());
|
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();
|
const PTR: *mut u32 = Unique::empty().as_ptr();
|
||||||
|
|
||||||
pub fn main() {
|
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 a new issue