Skip to content
Permalink
Browse files

extra paranoid mode

  • Loading branch information...
RalfJung committed Jun 8, 2019
1 parent a733b87 commit 3f99ad175a745bcb49eeef64675f1fa48d84016d
Showing with 5 additions and 3 deletions.
  1. +3 −2 src/test/run-pass/consts/const-ptr-nonnull.rs
  2. +2 −1 src/test/run-pass/consts/const-ptr-unique.rs
@@ -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());
}

0 comments on commit 3f99ad1

Please sign in to comment.
You can’t perform that action at this time.