rust/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
310 B
Rust
Raw Normal View History

2020-12-01 19:48:09 +05:30
#![feature(core_intrinsics)]
#![feature(const_heap)]
#![feature(const_mut_refs)]
use std::intrinsics;
const FOO: i32 = foo();
const fn foo() -> i32 {
unsafe {
let _ = intrinsics::const_allocate(4, 3) as *mut i32;
2021-06-18 19:31:56 +02:00
//~^ error: evaluation of constant value failed
2020-12-01 19:48:09 +05:30
}
1
}
fn main() {}