about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/ub-invalid-values.rs
blob: 8c47b1119f4279d4a98fb9b365a856b4e0f3761c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
const fn bool_cast(ptr: *const bool) { unsafe {
    let _val = *ptr as u32; //~ NOTE inside `bool_cast`
    //~^ NOTE the failure occurred here
}}

const _: () = {
    let v = 3_u8;
    bool_cast(&v as *const u8 as *const bool); //~ NOTE: failed inside this call
    //~^ ERROR interpreting an invalid 8-bit value as a bool
};

fn main() {}