-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
-Zmiri-check-number-validity
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// compile-flags: -Zmiri-check-number-validity | ||
|
||
// This test is adapted from https://github.com/rust-lang/miri/issues/1340#issue-600900312. | ||
|
||
fn main() { | ||
let _val = unsafe { std::mem::MaybeUninit::<f32>::uninit().assume_init() }; | ||
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// compile-flags: -Zmiri-check-number-validity | ||
|
||
// This test is from https://github.com/rust-lang/miri/issues/1340#issue-600900312. | ||
|
||
fn main() { | ||
let _val = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() }; | ||
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// compile-flags: -Zmiri-check-number-validity | ||
|
||
// This test is adapted from https://github.com/rust-lang/miri/issues/1340#issue-600900312. | ||
|
||
fn main() { | ||
let _val = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() }; | ||
//~^ ERROR type validation failed at .value: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This test is adapted from https://github.com/rust-lang/miri/issues/1340#issue-600900312. | ||
// This test passes because -Zmiri-check-number-validity is not passed. | ||
|
||
fn main() { | ||
let _val1 = unsafe { std::mem::MaybeUninit::<usize>::uninit().assume_init() }; | ||
let _val2 = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() }; | ||
let _val3 = unsafe { std::mem::MaybeUninit::<f32>::uninit().assume_init() }; | ||
} |