about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/heap/make-global-other.rs
blob: 4e2a59de13edcadd0d051ddfcb5cafa4d22d0be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Ensure that we can't call `const_make_global` on pointers not in the current interpreter.

#![feature(core_intrinsics)]
#![feature(const_heap)]

use std::intrinsics;

const X: &i32 = &0;

const Y: &i32 = unsafe {
    &*(intrinsics::const_make_global(X as *const i32 as *mut u8) as *const i32)
    //~^ error: pointer passed to `const_make_global` does not point to a heap allocation: ALLOC0<imm>
};

fn main() {}