Skip to content

Commit 372c6df

Browse files
committed
rustc_typeck: don't record associated type resolutions.
1 parent 548e681 commit 372c6df

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

src/librustc/middle/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
489489
}
490490

491491
hir::ExprPath(ref qpath) => {
492-
let def = self.tcx().tables().qpath_def(qpath, expr.id);
492+
let def = self.infcx.tables.borrow().qpath_def(qpath, expr.id);
493493
self.cat_def(expr.id, expr.span, expr_ty, def)
494494
}
495495

@@ -1087,7 +1087,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
10871087

10881088
match pat.node {
10891089
PatKind::TupleStruct(ref qpath, ref subpats, ddpos) => {
1090-
let def = self.tcx().tables().qpath_def(qpath, pat.id);
1090+
let def = self.infcx.tables.borrow().qpath_def(qpath, pat.id);
10911091
let expected_len = match def {
10921092
Def::VariantCtor(def_id, CtorKind::Fn) => {
10931093
let enum_def = self.tcx().parent_def_id(def_id).unwrap();

src/librustc_typeck/astconv.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1662,13 +1662,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
16621662
} else {
16631663
Def::Err
16641664
};
1665-
let (ty, def) = self.associated_path_def_to_ty(ast_ty.id, ast_ty.span,
1666-
ty, def, segment);
1667-
1668-
// Write back the new resolution.
1669-
tcx.tables.borrow_mut().type_relative_path_defs.insert(ast_ty.id, def);
1670-
1671-
ty
1665+
self.associated_path_def_to_ty(ast_ty.id, ast_ty.span, ty, def, segment).0
16721666
}
16731667
hir::TyArray(ref ty, ref e) => {
16741668
if let Ok(length) = eval_length(tcx.global_tcx(), &e, "array length") {

src/librustc_typeck/check/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
219219

220220
if let hir::ExprCall(ref expr, _) = call_expr.node {
221221
let def = if let hir::ExprPath(ref qpath) = expr.node {
222-
self.tcx.tables().qpath_def(qpath, expr.id)
222+
self.tables.borrow().qpath_def(qpath, expr.id)
223223
} else {
224224
Def::Err
225225
};

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4028,7 +4028,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
40284028
ty, def, segment);
40294029

40304030
// Write back the new resolution.
4031-
self.tcx.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
4031+
self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
40324032

40334033
(def, ty)
40344034
}
@@ -4069,7 +4069,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
40694069
};
40704070

40714071
// Write back the new resolution.
4072-
self.tcx.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
4072+
self.tables.borrow_mut().type_relative_path_defs.insert(node_id, def);
40734073
(def, Some(ty), slice::ref_slice(&**item_segment))
40744074
}
40754075

src/librustc_typeck/check/writeback.rs

+5
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
358358
}
359359

360360
fn visit_node_id(&self, reason: ResolveReason, id: ast::NodeId) {
361+
// Export associated path extensions.
362+
if let Some(def) = self.fcx.tables.borrow_mut().type_relative_path_defs.remove(&id) {
363+
self.tcx().tables.borrow_mut().type_relative_path_defs.insert(id, def);
364+
}
365+
361366
// Resolve any borrowings for the node with id `id`
362367
self.visit_adjustments(reason, id);
363368

0 commit comments

Comments
 (0)