diff options
| author | Ben Kimock <kimockb@gmail.com> | 2024-05-10 12:27:49 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2024-05-10 12:33:07 -0400 |
| commit | 2bb25d3f4ac8796a50f45409f3ef461ce83295f3 (patch) | |
| tree | bcaf1c55718cab13aad6d83eddb1b0bfc8d2fd5d /tests | |
| parent | 8f9080db423ca0fb6bef0686ce9a93940cdf1f13 (diff) | |
| download | rust-2bb25d3f4ac8796a50f45409f3ef461ce83295f3.tar.gz rust-2bb25d3f4ac8796a50f45409f3ef461ce83295f3.zip | |
Handle Deref expressions in invalid_reference_casting
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/lint/reference_casting.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/ui/lint/reference_casting.rs b/tests/ui/lint/reference_casting.rs index 87a682249b0..87fa42f9477 100644 --- a/tests/ui/lint/reference_casting.rs +++ b/tests/ui/lint/reference_casting.rs @@ -261,6 +261,13 @@ unsafe fn bigger_layout() { let ptr = r as *mut i32 as *mut Vec3<i32>; unsafe { *ptr = Vec3(0, 0, 0) } } + + unsafe fn deref(v: &mut Vec3<i32>) { + let r = &mut v.0; + let r = &mut *r; + let ptr = &mut *(r as *mut i32 as *mut Vec3<i32>); + unsafe { *ptr = Vec3(0, 0, 0) } + } } const RAW_PTR: *mut u8 = 1 as *mut u8; |
