1
Fork 0

Add test for invalid booleans.

This commit is contained in:
Scott Olson 2016-04-06 04:27:09 -06:00
parent 2d5196147f
commit cfe36d63e5
2 changed files with 7 additions and 1 deletions

View file

@ -17,3 +17,9 @@ fn pointers_to_different_allocations_are_unorderable() -> bool {
let y: *const u8 = &2; let y: *const u8 = &2;
x < y x < y
} }
#[miri_run]
fn invalid_bools_are_rejected() -> u8 {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
if b { 1 } else { 2 }
}

View file

@ -16,7 +16,7 @@ fn make_vec_macro() -> Vec<i32> {
#[miri_run] #[miri_run]
fn make_vec_macro_repeat() -> Vec<u8> { fn make_vec_macro_repeat() -> Vec<u8> {
vec![42; 8] vec![42; 5]
} }
#[miri_run] #[miri_run]