2018-08-25 04:07:21 -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-08-25 04:07:21 -05:00
|
|
|
|
|
|
|
// error-pattern: invalid enum discriminant
|
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum Foo {
|
|
|
|
A, B, C, D
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let f = unsafe { std::mem::transmute::<i32, Foo>(42) };
|
2018-11-26 08:31:53 -06:00
|
|
|
let _val = mem::discriminant(&f);
|
2018-08-25 04:07:21 -05:00
|
|
|
}
|