rustc_typeck: Autoderef::finalize is always called with one &hir::Expr.
This commit is contained in:
parent
e56b119bac
commit
2ad196444b
@ -149,11 +149,9 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> {
|
||||
self.fcx.resolve_type_vars_if_possible(&self.cur_ty)
|
||||
}
|
||||
|
||||
pub fn finalize<E>(self, pref: LvaluePreference, exprs: &[E])
|
||||
where E: AsCoercionSite
|
||||
{
|
||||
pub fn finalize(self, pref: LvaluePreference, expr: &hir::Expr) {
|
||||
let fcx = self.fcx;
|
||||
fcx.register_infer_ok_obligations(self.finalize_as_infer_ok(pref, exprs));
|
||||
fcx.register_infer_ok_obligations(self.finalize_as_infer_ok(pref, &[expr]));
|
||||
}
|
||||
|
||||
pub fn finalize_as_infer_ok<E>(self, pref: LvaluePreference, exprs: &[E])
|
||||
|
@ -55,7 +55,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
})
|
||||
.next();
|
||||
let callee_ty = autoderef.unambiguous_final_ty();
|
||||
autoderef.finalize(LvaluePreference::NoPreference, &[callee_expr]);
|
||||
autoderef.finalize(LvaluePreference::NoPreference, callee_expr);
|
||||
|
||||
let output = match result {
|
||||
None => {
|
||||
|
@ -137,7 +137,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
|
||||
assert_eq!(n, pick.autoderefs);
|
||||
|
||||
autoderef.unambiguous_final_ty();
|
||||
autoderef.finalize(LvaluePreference::NoPreference, &[self.self_expr]);
|
||||
autoderef.finalize(LvaluePreference::NoPreference, self.self_expr);
|
||||
|
||||
let target = pick.unsize.unwrap_or(autoderefd_ty);
|
||||
let target = target.adjust_for_autoref(self.tcx, autoref);
|
||||
@ -445,7 +445,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
|
||||
"expr was deref-able {} times but now isn't?",
|
||||
autoderefs);
|
||||
});
|
||||
autoderef.finalize(PreferMutLvalue, &[expr]);
|
||||
autoderef.finalize(PreferMutLvalue, expr);
|
||||
}
|
||||
}
|
||||
Some(_) | None => {}
|
||||
|
@ -2074,12 +2074,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
expr, base_expr, adj_ty, autoderefs,
|
||||
false, lvalue_pref, idx_ty)
|
||||
{
|
||||
autoderef.finalize(lvalue_pref, &[base_expr]);
|
||||
autoderef.finalize(lvalue_pref, base_expr);
|
||||
return Some(final_mt);
|
||||
}
|
||||
|
||||
if let ty::TyArray(element_ty, _) = adj_ty.sty {
|
||||
autoderef.finalize(lvalue_pref, &[base_expr]);
|
||||
autoderef.finalize(lvalue_pref, base_expr);
|
||||
let adjusted_ty = self.tcx.mk_slice(element_ty);
|
||||
return self.try_index_step(
|
||||
MethodCall::expr(expr.id), expr, base_expr,
|
||||
@ -2757,7 +2757,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
if let Some(field) = base_def.struct_variant().find_field_named(field.node) {
|
||||
let field_ty = self.field_ty(expr.span, field, substs);
|
||||
if self.tcx.vis_is_accessible_from(field.vis, self.body_id) {
|
||||
autoderef.finalize(lvalue_pref, &[base]);
|
||||
autoderef.finalize(lvalue_pref, base);
|
||||
self.apply_autoderef_adjustment(base.id, autoderefs, base_t);
|
||||
|
||||
self.tcx.check_stability(field.did, expr.id, expr.span);
|
||||
@ -2881,7 +2881,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||
};
|
||||
|
||||
if let Some(field_ty) = field {
|
||||
autoderef.finalize(lvalue_pref, &[base]);
|
||||
autoderef.finalize(lvalue_pref, base);
|
||||
self.apply_autoderef_adjustment(base.id, autoderefs, base_t);
|
||||
return field_ty;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user