Handle Deref expressions in invalid_reference_casting
This commit is contained in:
parent
8f9080db42
commit
2bb25d3f4a
2 changed files with 11 additions and 2 deletions
|
@ -202,8 +202,10 @@ fn is_cast_to_bigger_memory_layout<'tcx>(
|
|||
|
||||
// if the current expr looks like this `&mut expr[index]` then just looking
|
||||
// at `expr[index]` won't give us the underlying allocation, so we just skip it
|
||||
// the same logic applies field access like `&mut expr.field`
|
||||
if let ExprKind::Index(..) | ExprKind::Field(..) = e_alloc.kind {
|
||||
// the same logic applies field access `&mut expr.field` and reborrows `&mut *expr`.
|
||||
if let ExprKind::Index(..) | ExprKind::Field(..) | ExprKind::Unary(UnOp::Deref, ..) =
|
||||
e_alloc.kind
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue