2018-10-12 10:54:37 +02:00
|
|
|
// Validation makes this fail in the wrong place
|
2020-04-14 09:58:58 +02: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 10:54:37 +02:00
|
|
|
|
2018-08-24 19:18:21 +02:00
|
|
|
fn main() {
|
2020-05-02 02:13:48 +02:00
|
|
|
let c = 0xFFFFFFu32;
|
|
|
|
assert!(std::char::from_u32(c).is_none());
|
|
|
|
let c = unsafe { std::mem::transmute::<u32, char>(c) };
|
2022-03-17 13:49:10 +00:00
|
|
|
let _x = c == 'x'; //~ ERROR interpreting an invalid 32-bit value as a char
|
2018-08-24 19:18:21 +02:00
|
|
|
}
|