File tree 1 file changed +9
-0
lines changed
compiler/rustc_resolve/src
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -910,6 +910,8 @@ pub struct Resolver<'a> {
910
910
extern_crate_map : FxHashMap < LocalDefId , CrateNum > ,
911
911
export_map : ExportMap < LocalDefId > ,
912
912
trait_map : NodeMap < Vec < TraitCandidate > > ,
913
+ #[ cfg( debug_assertions) ]
914
+ took_trait_map : bool ,
913
915
914
916
/// A map from nodes to anonymous modules.
915
917
/// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -1139,6 +1141,11 @@ impl ResolverAstLowering for Resolver<'_> {
1139
1141
}
1140
1142
1141
1143
fn 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
+ }
1142
1149
std:: mem:: take ( & mut self . trait_map )
1143
1150
}
1144
1151
@@ -1287,6 +1294,8 @@ impl<'a> Resolver<'a> {
1287
1294
extern_crate_map : Default :: default ( ) ,
1288
1295
export_map : FxHashMap :: default ( ) ,
1289
1296
trait_map : Default :: default ( ) ,
1297
+ #[ cfg( debug_assertions) ]
1298
+ took_trait_map : false ,
1290
1299
underscore_disambiguator : 0 ,
1291
1300
empty_module,
1292
1301
module_map,
You can’t perform that action at this time.
0 commit comments