@@ -909,9 +909,7 @@ pub struct Resolver<'a> {
909
909
/// `CrateNum` resolutions of `extern crate` items.
910
910
extern_crate_map : FxHashMap < LocalDefId , CrateNum > ,
911
911
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 > > > ,
915
913
916
914
/// A map from nodes to anonymous modules.
917
915
/// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -1141,12 +1139,7 @@ impl ResolverAstLowering for Resolver<'_> {
1141
1139
}
1142
1140
1143
1141
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 ( )
1150
1143
}
1151
1144
1152
1145
fn opt_local_def_id ( & self , node : NodeId ) -> Option < LocalDefId > {
@@ -1293,9 +1286,7 @@ impl<'a> Resolver<'a> {
1293
1286
label_res_map : Default :: default ( ) ,
1294
1287
extern_crate_map : Default :: default ( ) ,
1295
1288
export_map : FxHashMap :: default ( ) ,
1296
- trait_map : Default :: default ( ) ,
1297
- #[ cfg( debug_assertions) ]
1298
- took_trait_map : false ,
1289
+ trait_map : Some ( NodeMap :: default ( ) ) ,
1299
1290
underscore_disambiguator : 0 ,
1300
1291
empty_module,
1301
1292
module_map,
0 commit comments