summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/issue-49296.rs
blob: 80f6bbec2a181f04d6146376b12e96c246ee72a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// issue-49296: Unsafe shenigans in constants can result in missing errors

#![feature(const_fn_trait_bound)]

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);
}