]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
Rollup merge of #103146 - joboet:cleanup_pthread_condvar, r=Mark-Simulacrum
[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(thread_local)]
7
8 #[thread_local]
9 static mut X1: u64 = 0;
10
11 struct S1 {
12     a: &'static mut u64,
13 }
14
15 impl S1 {
16     fn new(_x: u64) -> S1 {
17         S1 {
18             a: unsafe { &mut X1 },
19         }
20     }
21 }
22
23 fn main() {
24     S1::new(0).a;
25 }