Skip to content

Commit

Permalink
rustc_mir: don't miss the autoref when doing an unsize
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Nov 13, 2015
1 parent c1bfd0c commit cd1585f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/librustc_mir/hair/cx/expr.rs
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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() },
};
}
}
}

Expand Down

0 comments on commit cd1585f

Please sign in to comment.