diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-04-17 05:09:14 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-04-17 05:09:14 +0000 |
| commit | 2cb03ef7394bbcbdefea6dfb13a4d7c0458992fe (patch) | |
| tree | 66ea9a34daadc90de7f2a43fe186f19300365eb0 /src | |
| parent | e8739886f2b01758f1a1cc0b068001607389d08c (diff) | |
| download | rust-2cb03ef7394bbcbdefea6dfb13a4d7c0458992fe.tar.gz rust-2cb03ef7394bbcbdefea6dfb13a4d7c0458992fe.zip | |
fmt
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/miri/tests/pass/stacked-borrows/stacked-borrows.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/tools/miri/tests/pass/stacked-borrows/stacked-borrows.rs b/src/tools/miri/tests/pass/stacked-borrows/stacked-borrows.rs index 43ba490d5bb..c75824d7f9b 100644 --- a/src/tools/miri/tests/pass/stacked-borrows/stacked-borrows.rs +++ b/src/tools/miri/tests/pass/stacked-borrows/stacked-borrows.rs @@ -265,13 +265,15 @@ fn write_does_not_invalidate_all_aliases() { assert_eq!(*x, 1337); // oops, the value changed! I guess not all pointers were invalidated } -fn box_into_raw_allows_interior_mutable_alias() { unsafe { - let b = Box::new(std::cell::Cell::new(42)); - let raw = Box::into_raw(b); - let c = &*raw; - let d = raw.cast::<i32>(); // bypassing `Cell` -- only okay in Miri tests - // `c` and `d` should permit arbitrary aliasing with each other now. - *d = 1; - c.set(2); - drop(Box::from_raw(raw)); -} } +fn box_into_raw_allows_interior_mutable_alias() { + unsafe { + let b = Box::new(std::cell::Cell::new(42)); + let raw = Box::into_raw(b); + let c = &*raw; + let d = raw.cast::<i32>(); // bypassing `Cell` -- only okay in Miri tests + // `c` and `d` should permit arbitrary aliasing with each other now. + *d = 1; + c.set(2); + drop(Box::from_raw(raw)); + } +} |
