File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,8 @@ fn is_cast_to_bigger_memory_layout<'tcx>(
202
202
203
203
// if the current expr looks like this `&mut expr[index]` then just looking
204
204
// at `expr[index]` won't give us the underlying allocation, so we just skip it
205
- if let ExprKind :: Index ( ..) = e_alloc. kind {
205
+ // the same logic applies field access like `&mut expr.field`
206
+ if let ExprKind :: Index ( ..) | ExprKind :: Field ( ..) = e_alloc. kind {
206
207
return None ;
207
208
}
208
209
Original file line number Diff line number Diff line change @@ -255,6 +255,12 @@ unsafe fn bigger_layout() {
255
255
let a3 = a2 as * mut u64 ;
256
256
unsafe { * a3 = 3 } ;
257
257
}
258
+
259
+ unsafe fn field_access ( v : & mut Vec3 < i32 > ) {
260
+ let r = & mut v. 0 ;
261
+ let ptr = r as * mut i32 as * mut Vec3 < i32 > ;
262
+ unsafe { * ptr = Vec3 ( 0 , 0 , 0 ) }
263
+ }
258
264
}
259
265
260
266
const RAW_PTR : * mut u8 = 1 as * mut u8 ;
You can’t perform that action at this time.
0 commit comments