Skip to content

Commit

Permalink
rustc_typeck: don't record associated type resolutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Nov 28, 2016
1 parent 548e681 commit 372c6df
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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();
Expand Down
8 changes: 1 addition & 7 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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))
}

Expand Down
5 changes: 5 additions & 0 deletions src/librustc_typeck/check/writeback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 372c6df

Please sign in to comment.