]> git.lizzy.rs Git - rust.git/commitdiff
Add test for invalid booleans.
authorScott Olson <scott@solson.me>
Wed, 6 Apr 2016 10:27:09 +0000 (04:27 -0600)
committerScott Olson <scott@solson.me>
Wed, 6 Apr 2016 10:27:09 +0000 (04:27 -0600)
test/errors.rs
test/vecs.rs

index 8faff149167e9ba3071d4585333ad99f76160a19..8d66ec48ad146a2cbf7b1df7b084671bd9c9730c 100755 (executable)
@@ -17,3 +17,9 @@ fn pointers_to_different_allocations_are_unorderable() -> bool {
     let y: *const u8 = &2;
     x < y
 }
+
+#[miri_run]
+fn invalid_bools_are_rejected() -> u8 {
+    let b = unsafe { std::mem::transmute::<u8, bool>(2) };
+    if b { 1 } else { 2 }
+}
index b2f2f27ceeabf2c0bd9bb9477030a85ed128962d..e9f6c12b4409052ecbe694ba758a8acd8f9c3c52 100755 (executable)
@@ -16,7 +16,7 @@ fn make_vec_macro() -> Vec<i32> {
 
 #[miri_run]
 fn make_vec_macro_repeat() -> Vec<u8> {
-    vec![42; 8]
+    vec![42; 5]
 }
 
 #[miri_run]