Skip to content

Commit

Permalink
extra paranoid mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 8, 2019
1 parent a733b87 commit 3f99ad1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/test/run-pass/consts/const-ptr-nonnull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)());
}
3 changes: 2 additions & 1 deletion src/test/run-pass/consts/const-ptr-unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.