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 08:18:09 -06:00
#![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 12:31:56 -05:00
//~^ error: evaluation of constant value failed
2020-12-01 08:18:09 -06:00
}
1
}
fn main() {}