@@ -289,6 +289,8 @@ pub struct TyCtxt<'tcx> {
289
289
// scratch every time.
290
290
pub freevars : RefCell < FreevarMap > ,
291
291
292
+ pub maybe_unused_trait_imports : NodeSet ,
293
+
292
294
// Records the type of every item.
293
295
pub tcache : RefCell < DepTrackingMap < maps:: Tcache < ' tcx > > > ,
294
296
@@ -338,6 +340,10 @@ pub struct TyCtxt<'tcx> {
338
340
/// about.
339
341
pub used_mut_nodes : RefCell < NodeSet > ,
340
342
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
+
341
347
/// The set of external nominal types whose implementations have been read.
342
348
/// This is used for lazy resolution of methods.
343
349
pub populated_external_types : RefCell < DefIdSet > ,
@@ -543,6 +549,7 @@ impl<'tcx> TyCtxt<'tcx> {
543
549
named_region_map : resolve_lifetime:: NamedRegionMap ,
544
550
map : ast_map:: Map < ' tcx > ,
545
551
freevars : FreevarMap ,
552
+ maybe_unused_trait_imports : NodeSet ,
546
553
region_maps : RegionMaps ,
547
554
lang_items : middle:: lang_items:: LanguageItems ,
548
555
stability : stability:: Index < ' tcx > ,
@@ -581,6 +588,7 @@ impl<'tcx> TyCtxt<'tcx> {
581
588
fulfilled_predicates : RefCell :: new ( fulfilled_predicates) ,
582
589
map : map,
583
590
freevars : RefCell :: new ( freevars) ,
591
+ maybe_unused_trait_imports : maybe_unused_trait_imports,
584
592
tcache : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
585
593
rcache : RefCell :: new ( FnvHashMap ( ) ) ,
586
594
tc_cache : RefCell :: new ( FnvHashMap ( ) ) ,
@@ -595,6 +603,7 @@ impl<'tcx> TyCtxt<'tcx> {
595
603
impl_items : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
596
604
used_unsafe : RefCell :: new ( NodeSet ( ) ) ,
597
605
used_mut_nodes : RefCell :: new ( NodeSet ( ) ) ,
606
+ used_trait_imports : RefCell :: new ( NodeSet ( ) ) ,
598
607
populated_external_types : RefCell :: new ( DefIdSet ( ) ) ,
599
608
populated_external_primitive_impls : RefCell :: new ( DefIdSet ( ) ) ,
600
609
extern_const_statics : RefCell :: new ( DefIdMap ( ) ) ,
0 commit comments