-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from RalfJung/pragmatic-ptr-eq
be pragmatic about ptr-int comparisons, for now
- Loading branch information
Showing
3 changed files
with
19 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
use std::mem; | ||
|
||
fn main() { | ||
let b = Box::new(0); | ||
let x = &*b as *const i32; | ||
// We cannot compare this with a non-NULL integer. After all, these *could* be equal (with the right base address). | ||
assert!(x != mem::align_of::<i32>() as *const i32); //~ ERROR invalid arithmetic on pointers | ||
assert!(x != 64 as *const i32); //~ ERROR invalid arithmetic on pointers | ||
} |
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