mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
15 lines
283 B
Rust
15 lines
283 B
Rust
// 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);
|
|
}
|