@@ -289,6 +289,8 @@ pub struct TyCtxt<'tcx> {
289289 // scratch every time.
290290 pub freevars : RefCell < FreevarMap > ,
291291
292+ pub maybe_unused_trait_imports : NodeSet ,
293+
292294 // Records the type of every item.
293295 pub tcache : RefCell < DepTrackingMap < maps:: Tcache < ' tcx > > > ,
294296
@@ -338,6 +340,10 @@ pub struct TyCtxt<'tcx> {
338340 /// about.
339341 pub used_mut_nodes : RefCell < NodeSet > ,
340342
343+ /// Set of trait imports actually used in the method resolution.
344+ /// This is used for warning unused imports.
345+ pub used_trait_imports : RefCell < NodeSet > ,
346+
341347 /// The set of external nominal types whose implementations have been read.
342348 /// This is used for lazy resolution of methods.
343349 pub populated_external_types : RefCell < DefIdSet > ,
@@ -543,6 +549,7 @@ impl<'tcx> TyCtxt<'tcx> {
543549 named_region_map : resolve_lifetime:: NamedRegionMap ,
544550 map : ast_map:: Map < ' tcx > ,
545551 freevars : FreevarMap ,
552+ maybe_unused_trait_imports : NodeSet ,
546553 region_maps : RegionMaps ,
547554 lang_items : middle:: lang_items:: LanguageItems ,
548555 stability : stability:: Index < ' tcx > ,
@@ -581,6 +588,7 @@ impl<'tcx> TyCtxt<'tcx> {
581588 fulfilled_predicates : RefCell :: new ( fulfilled_predicates) ,
582589 map : map,
583590 freevars : RefCell :: new ( freevars) ,
591+ maybe_unused_trait_imports : maybe_unused_trait_imports,
584592 tcache : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
585593 rcache : RefCell :: new ( FnvHashMap ( ) ) ,
586594 tc_cache : RefCell :: new ( FnvHashMap ( ) ) ,
@@ -595,6 +603,7 @@ impl<'tcx> TyCtxt<'tcx> {
595603 impl_items : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
596604 used_unsafe : RefCell :: new ( NodeSet ( ) ) ,
597605 used_mut_nodes : RefCell :: new ( NodeSet ( ) ) ,
606+ used_trait_imports : RefCell :: new ( NodeSet ( ) ) ,
598607 populated_external_types : RefCell :: new ( DefIdSet ( ) ) ,
599608 populated_external_primitive_impls : RefCell :: new ( DefIdSet ( ) ) ,
600609 extern_const_statics : RefCell :: new ( DefIdMap ( ) ) ,
0 commit comments