diff options
| author | Amanjeev Sethi <aj@amanjeev.com> | 2022-09-02 19:12:03 -0400 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-02-15 10:25:06 +0000 |
| commit | ca109af2acceee83b21fefe22713e3f34c04130b (patch) | |
| tree | b77774696affe47faebf27ea224e2d8303084bfb | |
| parent | bd6b3361339522cc258d1f4165e3340e4cb1add4 (diff) | |
| download | rust-ca109af2acceee83b21fefe22713e3f34c04130b.tar.gz rust-ca109af2acceee83b21fefe22713e3f34c04130b.zip | |
Add regression test
| -rw-r--r-- | tests/ui/statics/recursive_interior_mut.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/statics/recursive_interior_mut.rs b/tests/ui/statics/recursive_interior_mut.rs new file mode 100644 index 00000000000..7e3083909d5 --- /dev/null +++ b/tests/ui/statics/recursive_interior_mut.rs @@ -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() {} |
