]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
Rollup merge of #60685 - dtolnay:spdx, r=nikomatsakis
[rust.git] / src / test / ui / nll / borrowck-thread-local-static-mut-borrow-outlives-fn.rs
1 //
2 // run-pass
3 //
4 // FIXME(#54366) - We probably shouldn't allow #[thread_local] static mut to get a 'static lifetime.
5
6 #![feature(nll)]
7 #![feature(thread_local)]
8
9 #[thread_local]
10 static mut X1: u64 = 0;
11
12 struct S1 {
13     a: &'static mut u64,
14 }
15
16 impl S1 {
17     fn new(_x: u64) -> S1 {
18         S1 {
19             a: unsafe { &mut X1 },
20         }
21     }
22 }
23
24 fn main() {
25     S1::new(0).a;
26 }