@@ -829,7 +829,7 @@ pub struct ModuleS<'a> {
829
829
globs : RefCell < Vec < & ' a ImportDirective < ' a > > > ,
830
830
831
831
// Used to memoize the traits in this module for faster searches through all traits in scope.
832
- traits : RefCell < Option < Box < [ & ' a NameBinding < ' a > ] > > > ,
832
+ traits : RefCell < Option < Box < [ ( Name , & ' a NameBinding < ' a > ) ] > > > ,
833
833
834
834
// Whether this module is populated. If not populated, any attempt to
835
835
// access the children must be preceded with a
@@ -1234,14 +1234,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1234
1234
self . glob_map . insert ( directive. id , new_set) ;
1235
1235
}
1236
1236
1237
- fn get_trait_name ( & self , did : DefId ) -> Name {
1238
- if let Some ( node_id) = self . ast_map . as_local_node_id ( did) {
1239
- self . ast_map . expect_item ( node_id) . name
1240
- } else {
1241
- self . session . cstore . item_name ( did)
1242
- }
1243
- }
1244
-
1245
1237
/// Resolves the given module path from the given root `module_`.
1246
1238
fn resolve_module_path_from_root ( & mut self ,
1247
1239
module_ : Module < ' a > ,
@@ -3146,20 +3138,19 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3146
3138
let mut traits = module. traits . borrow_mut ( ) ;
3147
3139
if traits. is_none ( ) {
3148
3140
let mut collected_traits = Vec :: new ( ) ;
3149
- module. for_each_child ( |_ , ns, binding| {
3141
+ module. for_each_child ( |name , ns, binding| {
3150
3142
if ns != TypeNS { return }
3151
3143
if let Some ( Def :: Trait ( _) ) = binding. def ( ) {
3152
- collected_traits. push ( binding) ;
3144
+ collected_traits. push ( ( name , binding) ) ;
3153
3145
}
3154
3146
} ) ;
3155
3147
* traits = Some ( collected_traits. into_boxed_slice ( ) ) ;
3156
3148
}
3157
3149
3158
- for binding in traits. as_ref ( ) . unwrap ( ) . iter ( ) {
3150
+ for & ( trait_name , binding) in traits. as_ref ( ) . unwrap ( ) . iter ( ) {
3159
3151
let trait_def_id = binding. def ( ) . unwrap ( ) . def_id ( ) ;
3160
3152
if self . trait_item_map . contains_key ( & ( name, trait_def_id) ) {
3161
3153
add_trait_info ( & mut found_traits, trait_def_id, name) ;
3162
- let trait_name = self . get_trait_name ( trait_def_id) ;
3163
3154
self . record_use ( trait_name, TypeNS , binding) ;
3164
3155
}
3165
3156
}
0 commit comments