@@ -829,7 +829,7 @@ pub struct ModuleS<'a> {
829829 globs : RefCell < Vec < & ' a ImportDirective < ' a > > > ,
830830
831831 // 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 > ) ] > > > ,
833833
834834 // Whether this module is populated. If not populated, any attempt to
835835 // access the children must be preceded with a
@@ -1234,14 +1234,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12341234 self . glob_map . insert ( directive. id , new_set) ;
12351235 }
12361236
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-
12451237 /// Resolves the given module path from the given root `module_`.
12461238 fn resolve_module_path_from_root ( & mut self ,
12471239 module_ : Module < ' a > ,
@@ -3146,20 +3138,19 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
31463138 let mut traits = module. traits . borrow_mut ( ) ;
31473139 if traits. is_none ( ) {
31483140 let mut collected_traits = Vec :: new ( ) ;
3149- module. for_each_child ( |_ , ns, binding| {
3141+ module. for_each_child ( |name , ns, binding| {
31503142 if ns != TypeNS { return }
31513143 if let Some ( Def :: Trait ( _) ) = binding. def ( ) {
3152- collected_traits. push ( binding) ;
3144+ collected_traits. push ( ( name , binding) ) ;
31533145 }
31543146 } ) ;
31553147 * traits = Some ( collected_traits. into_boxed_slice ( ) ) ;
31563148 }
31573149
3158- for binding in traits. as_ref ( ) . unwrap ( ) . iter ( ) {
3150+ for & ( trait_name , binding) in traits. as_ref ( ) . unwrap ( ) . iter ( ) {
31593151 let trait_def_id = binding. def ( ) . unwrap ( ) . def_id ( ) ;
31603152 if self . trait_item_map . contains_key ( & ( name, trait_def_id) ) {
31613153 add_trait_info ( & mut found_traits, trait_def_id, name) ;
3162- let trait_name = self . get_trait_name ( trait_def_id) ;
31633154 self . record_use ( trait_name, TypeNS , binding) ;
31643155 }
31653156 }
0 commit comments