]> git.lizzy.rs Git - rust.git/commitdiff
rustc_typeck: don't record associated type resolutions.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Thu, 24 Nov 2016 17:42:10 +0000 (19:42 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Mon, 28 Nov 2016 03:12:41 +0000 (05:12 +0200)
src/librustc/middle/mem_categorization.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/writeback.rs

index b9542d6fc5c4b81b8e2da496c485d3085e453729..8d3e734f8c33f8e6735660caf23d152c91d32a25 100644 (file)
@@ -489,7 +489,7 @@ pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult<cmt<'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 @@ fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McResul
 
         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();
index 8a8b34342940d70cf6365dbbd314b592bdd14824..bb7b62533001db17b633a294ca0f93615511af6e 100644 (file)
@@ -1662,13 +1662,7 @@ pub fn ast_ty_to_ty(&self, rscope: &RegionScope, ast_ty: &hir::Ty) -> Ty<'tcx> {
                 } 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") {
index fdf496b7c86f473dcebde50b0ecedc0297423a73..6d00f481fa263a4877471f8b7c6880b3eb20cdc8 100644 (file)
@@ -219,7 +219,7 @@ fn confirm_builtin_call(&self,
 
                 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
                     };
index 76bd961ebd2fcab3d66445a22ab66f3c7868c84c..2babb81bc407a47b5b6295e5db99a1bdb79b9f21 100644 (file)
@@ -4028,7 +4028,7 @@ fn finish_resolving_struct_path(&self,
                                                                    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 @@ pub fn resolve_ty_and_def_ufcs<'b>(&self,
         };
 
         // 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))
     }
 
index 1e26d1b80d31e5df3544d291eaf970a47d9657c8..45b3dae3e9f83cb224204a12625024c3ff9a605e 100644 (file)
@@ -358,6 +358,11 @@ fn visit_anon_types(&self) {
     }
 
     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);