@@ -909,9 +909,7 @@ pub struct Resolver<'a> {
909909 /// `CrateNum` resolutions of `extern crate` items.
910910 extern_crate_map : FxHashMap < LocalDefId , CrateNum > ,
911911 export_map : ExportMap < LocalDefId > ,
912- trait_map : NodeMap < Vec < TraitCandidate > > ,
913- #[ cfg( debug_assertions) ]
914- took_trait_map : bool ,
912+ trait_map : Option < NodeMap < Vec < TraitCandidate > > > ,
915913
916914 /// A map from nodes to anonymous modules.
917915 /// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -1141,12 +1139,7 @@ impl ResolverAstLowering for Resolver<'_> {
11411139 }
11421140
11431141 fn take_trait_map ( & mut self ) -> NodeMap < Vec < TraitCandidate > > {
1144- #[ cfg( debug_assertions) ]
1145- {
1146- debug_assert ! ( !self . took_trait_map) ;
1147- self . took_trait_map = true ;
1148- }
1149- std:: mem:: take ( & mut self . trait_map )
1142+ std:: mem:: replace ( & mut self . trait_map , None ) . unwrap ( )
11501143 }
11511144
11521145 fn opt_local_def_id ( & self , node : NodeId ) -> Option < LocalDefId > {
@@ -1293,9 +1286,7 @@ impl<'a> Resolver<'a> {
12931286 label_res_map : Default :: default ( ) ,
12941287 extern_crate_map : Default :: default ( ) ,
12951288 export_map : FxHashMap :: default ( ) ,
1296- trait_map : Default :: default ( ) ,
1297- #[ cfg( debug_assertions) ]
1298- took_trait_map : false ,
1289+ trait_map : Some ( NodeMap :: default ( ) ) ,
12991290 underscore_disambiguator : 0 ,
13001291 empty_module,
13011292 module_map,
0 commit comments