about summary refs log tree commit diff
path: root/tests/ui/statics/recursive_interior_mut.rs
blob: 43e9d0c50913c58e8d7fa1a8cb110298d1326cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@ check-pass

use std::cell::Cell;
use std::ptr::NonNull;

struct ChunkFooter {
    prev: Cell<NonNull<ChunkFooter>>,
}

struct EmptyChunkFooter(ChunkFooter);

unsafe impl Sync for EmptyChunkFooter {}

static EMPTY_CHUNK: EmptyChunkFooter = EmptyChunkFooter(ChunkFooter {
    prev: Cell::new(unsafe {
        NonNull::new_unchecked(&EMPTY_CHUNK as *const EmptyChunkFooter as *mut ChunkFooter)
    }),
});

fn main() {}