Skip to content

Commit 93e0bc6

Browse files
committed
change the used_trait_imports map to be a DefIdSet
1 parent 5a60194 commit 93e0bc6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/librustc/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ pub struct GlobalCtxt<'tcx> {
494494

495495
/// Set of trait imports actually used in the method resolution.
496496
/// This is used for warning unused imports.
497-
pub used_trait_imports: RefCell<NodeSet>,
497+
pub used_trait_imports: RefCell<DefIdSet>,
498498

499499
/// The set of external nominal types whose implementations have been read.
500500
/// This is used for lazy resolution of methods.
@@ -783,7 +783,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
783783
inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
784784
used_unsafe: RefCell::new(NodeSet()),
785785
used_mut_nodes: RefCell::new(NodeSet()),
786-
used_trait_imports: RefCell::new(NodeSet()),
786+
used_trait_imports: RefCell::new(DefIdSet()),
787787
populated_external_types: RefCell::new(DefIdSet()),
788788
populated_external_primitive_impls: RefCell::new(DefIdSet()),
789789
stability: RefCell::new(stability),

src/librustc_typeck/check/method/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
137137
self_ty, call_expr.id)?;
138138

139139
if let Some(import_id) = pick.import_id {
140-
self.tcx.used_trait_imports.borrow_mut().insert(import_id);
140+
let import_def_id = self.tcx.hir.local_def_id(import_id);
141+
self.tcx.used_trait_imports.borrow_mut().insert(import_def_id);
141142
}
142143

143144
self.tcx.check_stability(pick.item.def_id, call_expr.id, span);
@@ -336,7 +337,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
336337
self_ty, expr_id)?;
337338

338339
if let Some(import_id) = pick.import_id {
339-
self.tcx.used_trait_imports.borrow_mut().insert(import_id);
340+
let import_def_id = self.tcx.hir.local_def_id(import_id);
341+
self.tcx.used_trait_imports.borrow_mut().insert(import_def_id);
340342
}
341343

342344
let def = pick.item.def();

src/librustc_typeck/check_unused.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ impl<'a, 'tcx> UnusedTraitImportVisitor<'a, 'tcx> {
2727
if !self.tcx.maybe_unused_trait_imports.contains(&id) {
2828
return;
2929
}
30-
if self.tcx.used_trait_imports.borrow().contains(&id) {
30+
31+
let import_def_id = self.tcx.hir.local_def_id(id);
32+
if self.tcx.used_trait_imports.borrow().contains(&import_def_id) {
3133
return;
3234
}
3335

0 commit comments

Comments
 (0)