summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/issue-49296.rs
blob: 917777a32fff3118a842763679d5abe2f2b49581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// issue-49296: Unsafe shenigans in constants can result in missing errors

use std::mem::transmute;

const fn wat(x: u64) -> &'static u64 {
    unsafe { transmute(&x) }
}

const X: u64 = *wat(42);
//~^ ERROR evaluation of constant value failed

fn main() {
    println!("{}", X);
}