change the used_trait_imports
map to be a DefIdSet
This commit is contained in:
parent
5a6019429f
commit
93e0bc6520
@ -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 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
||||
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),
|
||||
|
@ -137,7 +137,8 @@ pub fn lookup_method(&self,
|
||||
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 @@ pub fn resolve_ufcs(&self,
|
||||
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();
|
||||
|
@ -27,7 +27,9 @@ fn check_import(&self, id: ast::NodeId, span: Span) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user