rustc_typeck: don't record associated type resolutions.

This commit is contained in:
Eduard-Mihai Burtescu 2016-11-24 19:42:10 +02:00
parent 548e681f2f
commit 372c6df564
5 changed files with 11 additions and 12 deletions

View File

@ -489,7 +489,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
}
hir::ExprPath(ref qpath) => {
let def = self.tcx().tables().qpath_def(qpath, expr.id);
let def = self.infcx.tables.borrow().qpath_def(qpath, expr.id);
self.cat_def(expr.id, expr.span, expr_ty, def)
}
@ -1087,7 +1087,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
match pat.node {
PatKind::TupleStruct(ref qpath, ref subpats, ddpos) => {
let def = self.tcx().tables().qpath_def(qpath, pat.id);
let def = self.infcx.tables.borrow().qpath_def(qpath, pat.id);
let expected_len = match def {
Def::VariantCtor(def_id, CtorKind::Fn) => {
let enum_def = self.tcx().parent_def_id(def_id).unwrap();

View File

@ -1662,13 +1662,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
} else {
Def::Err
};
let (ty, def) = self.associated_path_def_to_ty(ast_ty.id, ast_ty.span,
ty, def, segment);
// Write back the new resolution.
tcx.tables.borrow_mut().type_relative_path_defs.insert(ast_ty.id, def);
ty
self.associated_path_def_to_ty(ast_ty.id, ast_ty.span, ty, def, segment).0
}
hir::TyArray(ref ty, ref e) => {
if let Ok(length) = eval_length(tcx.global_tcx(), &e, "array length") {

View File

@ -219,7 +219,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let hir::ExprCall(ref expr, _) = call_expr.node {
let def = if let hir::ExprPath(ref qpath) = expr.node {
self.tcx.tables().qpath_def(qpath, expr.id)
self.tables.borrow().qpath_def(qpath, expr.id)
} else {
Def::Err
};

View File

@ -4028,7 +4028,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
ty, def, segment);
// Write back the new resolution.
self.tcx.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
(def, ty)
}
@ -4069,7 +4069,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
};
// Write back the new resolution.
self.tcx.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
(def, Some(ty), slice::ref_slice(&**item_segment))
}

View File

@ -358,6 +358,11 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
}
fn visit_node_id(&self, reason: ResolveReason, id: ast::NodeId) {
// Export associated path extensions.
if let Some(def) = self.fcx.tables.borrow_mut().type_relative_path_defs.remove(&id) {
self.tcx().tables.borrow_mut().type_relative_path_defs.insert(id, def);
}
// Resolve any borrowings for the node with id `id`
self.visit_adjustments(reason, id);