2018-10-12 03:54:37 -05:00
|
|
|
// Validation makes this fail in the wrong place
|
2020-04-14 02:58:58 -05:00
|
|
|
// Make sure we find these even with many checks disabled.
|
|
|
|
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
2018-10-12 03:54:37 -05:00
|
|
|
|
2018-08-24 12:18:21 -05:00
|
|
|
fn main() {
|
|
|
|
assert!(std::char::from_u32(-1_i32 as u32).is_none());
|
|
|
|
let c = unsafe { std::mem::transmute::<i32, char>(-1) };
|
2020-03-08 17:34:54 -05:00
|
|
|
let _x = c == 'x'; //~ ERROR interpreting an invalid 32-bit value as a char
|
2018-08-24 12:18:21 -05:00
|
|
|
}
|