about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-01-28 06:02:28 -0500
committerNiko Matsakis <niko@alum.mit.edu>2017-02-02 20:35:41 -0500
commit93e0bc6520b8d1e1ae0e886cdf7b083073e40be8 (patch)
treeb5040ba5767ea562dda22fc1295d20a6bd824799 /src
parent5a6019429f68d2fa8b92285d7dfdcd2f30fd1303 (diff)
downloadrust-93e0bc6520b8d1e1ae0e886cdf7b083073e40be8.tar.gz
rust-93e0bc6520b8d1e1ae0e886cdf7b083073e40be8.zip
change the `used_trait_imports` map to be a `DefIdSet`
Diffstat (limited to 'src')
-rw-r--r--src/librustc/ty/context.rs4
-rw-r--r--src/librustc_typeck/check/method/mod.rs6
-rw-r--r--src/librustc_typeck/check_unused.rs4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index ce4a6a31826..5913ed48528 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -494,7 +494,7 @@ pub struct GlobalCtxt<'tcx> {
 
     /// Set of trait imports actually used in the method resolution.
     /// This is used for warning unused imports.
-    pub used_trait_imports: RefCell<NodeSet>,
+    pub used_trait_imports: RefCell<DefIdSet>,
 
     /// The set of external nominal types whose implementations have been read.
     /// This is used for lazy resolution of methods.
@@ -783,7 +783,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
             inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
             used_unsafe: RefCell::new(NodeSet()),
             used_mut_nodes: RefCell::new(NodeSet()),
-            used_trait_imports: RefCell::new(NodeSet()),
+            used_trait_imports: RefCell::new(DefIdSet()),
             populated_external_types: RefCell::new(DefIdSet()),
             populated_external_primitive_impls: RefCell::new(DefIdSet()),
             stability: RefCell::new(stability),
diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs
index 9b8e77301e5..f8b6fbc9e81 100644
--- a/src/librustc_typeck/check/method/mod.rs
+++ b/src/librustc_typeck/check/method/mod.rs
@@ -137,7 +137,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                        self_ty, call_expr.id)?;
 
         if let Some(import_id) = pick.import_id {
-            self.tcx.used_trait_imports.borrow_mut().insert(import_id);
+            let import_def_id = self.tcx.hir.local_def_id(import_id);
+            self.tcx.used_trait_imports.borrow_mut().insert(import_def_id);
         }
 
         self.tcx.check_stability(pick.item.def_id, call_expr.id, span);
@@ -336,7 +337,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                        self_ty, expr_id)?;
 
         if let Some(import_id) = pick.import_id {
-            self.tcx.used_trait_imports.borrow_mut().insert(import_id);
+            let import_def_id = self.tcx.hir.local_def_id(import_id);
+            self.tcx.used_trait_imports.borrow_mut().insert(import_def_id);
         }
 
         let def = pick.item.def();
diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs
index bdda538db16..c1ba53afad4 100644
--- a/src/librustc_typeck/check_unused.rs
+++ b/src/librustc_typeck/check_unused.rs
@@ -27,7 +27,9 @@ impl<'a, 'tcx> UnusedTraitImportVisitor<'a, 'tcx> {
         if !self.tcx.maybe_unused_trait_imports.contains(&id) {
             return;
         }
-        if self.tcx.used_trait_imports.borrow().contains(&id) {
+
+        let import_def_id = self.tcx.hir.local_def_id(id);
+        if self.tcx.used_trait_imports.borrow().contains(&import_def_id) {
             return;
         }