rust/tests/ui/feature-gates/feature-gate-const-refs-to-static.rs

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

12 lines
304 B
Rust
Raw Normal View History

static S: i32 = 0;
static mut S_MUT: i32 = 0;
const C1: &i32 = &S; //~ERROR: referencing statics in constants is unstable
const C1_READ: () = {
assert!(*C1 == 0);
};
const C2: *const i32 = unsafe { std::ptr::addr_of!(S_MUT) }; //~ERROR: referencing statics in constants is unstable
fn main() {
}