Skip to content

Commit

Permalink
fix miri tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bend-n committed Mar 7, 2025
1 parent 4b15996 commit ceea0c0
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/tools/miri/tests/fail/validity/invalid_bool.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(redundant_transmutation)]
fn main() {
let _b = unsafe { std::mem::transmute::<u8, bool>(2) }; //~ ERROR: expected a boolean
}
1 change: 1 addition & 0 deletions src/tools/miri/tests/fail/validity/invalid_bool_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Make sure we find these even with many checks disabled.
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

#![allow(redundant_transmutation)]
fn main() {
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
let _x = b == std::hint::black_box(true); //~ ERROR: interpreting an invalid 8-bit value as a bool
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/fail/validity/invalid_char.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(redundant_transmutation)]
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } {
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/fail/validity/invalid_char_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Make sure we find these even with many checks disabled.
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation

#![allow(redundant_transmutation)]
fn main() {
let c = 0xFFFFFFu32;
assert!(std::char::from_u32(c).is_none());
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/tests/pass/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#![feature(f128)]
#![feature(f16)]
#![allow(arithmetic_overflow)]
#![allow(internal_features, redundant_transmutation)]
#![allow(internal_features)]
#![allow(redundant_transmutation)]

use std::any::type_name;
use std::cmp::min;
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/pass/issues/issue-miri-184.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(redundant_transmutation)]
pub fn main() {
let bytes: [u8; 8] = unsafe { ::std::mem::transmute(0u64) };
let _val: &[u8] = &bytes;
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/pass/shims/x86/intrinsics-x86-sse.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// We're testing x86 target specific features
//@only-target: x86_64 i686
#![allow(redundant_transmutation)]

#[cfg(target_arch = "x86")]
use std::arch::x86::*;
Expand Down

0 comments on commit ceea0c0

Please sign in to comment.