Add regression test
This commit is contained in:
parent
bd6b336133
commit
ca109af2ac
1 changed files with 20 additions and 0 deletions
20
tests/ui/statics/recursive_interior_mut.rs
Normal file
20
tests/ui/statics/recursive_interior_mut.rs
Normal file
|
@ -0,0 +1,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() {}
|
Loading…
Add table
Add a link
Reference in a new issue