summary refs log tree commit diff
path: root/tests/ui/statics/nested_thread_local.rs
blob: a512016335a0056e4914a5bc218d5e2584129cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Check that we forbid nested statics in `thread_local` statics.

#![feature(const_refs_to_cell)]
#![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() {}