rustc_mir: don't miss the autoref when doing an unsize
This commit is contained in:
parent
c1bfd0ca6b
commit
cd1585ffb3
@ -386,14 +386,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(target) = adj.unsize {
|
||||
expr = Expr {
|
||||
temp_lifetime: temp_lifetime,
|
||||
ty: target,
|
||||
span: self.span,
|
||||
kind: ExprKind::Unsize { source: expr.to_ref() },
|
||||
};
|
||||
} else if let Some(autoref) = adj.autoref {
|
||||
if let Some(autoref) = adj.autoref {
|
||||
let adjusted_ty = expr.ty.adjust_for_autoref(cx.tcx, Some(autoref));
|
||||
match autoref {
|
||||
ty::adjustment::AutoPtr(r, m) => {
|
||||
@ -433,6 +426,15 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(target) = adj.unsize {
|
||||
expr = Expr {
|
||||
temp_lifetime: temp_lifetime,
|
||||
ty: target,
|
||||
span: self.span,
|
||||
kind: ExprKind::Unsize { source: expr.to_ref() },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user