1
Fork 0

Account for * when looking for inner-most path in expression

This commit is contained in:
Esteban Küber 2023-01-17 02:45:11 +00:00
parent e4f61afa77
commit be2ec32b18
8 changed files with 31 additions and 2 deletions

View file

@ -75,7 +75,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
let mut expr_finder = FindExprBySpan::new(span);
expr_finder.visit_expr(body.value);
if let Some(mut expr) = expr_finder.result {
while let hir::ExprKind::AddrOf(_, _, inner) = &expr.kind {
while let hir::ExprKind::AddrOf(_, _, inner)
| hir::ExprKind::Unary(hir::UnOp::Deref, inner) = &expr.kind
{
expr = inner;
}
if let hir::ExprKind::Path(hir::QPath::Resolved(None, p)) = expr.kind