rust/tests/ui/statics/nested_thread_local.rs

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

14 lines
308 B
Rust
Raw Normal View History

// Check that we forbid nested statics in `thread_local` statics.
#![feature(thread_local)]
#[thread_local]
static mut FOO: &u32 = {
//~^ ERROR: does not support implicit nested statics
// Prevent promotion (that would trigger on `&42` as an expression)
let x = 42;
&{ x }
};
fn main() {}