@@ -6336,10 +6336,10 @@ pub fn populate_implementations_for_primitive_if_necessary(tcx: &ctxt,
63366336 tcx. populated_external_primitive_impls . borrow_mut ( ) . insert ( primitive_def_id) ;
63376337}
63386338
6339- /// Populates the type context with all the implementations for the given type
6340- /// if necessary.
6341- pub fn populate_implementations_for_type_if_necessary ( tcx : & ctxt ,
6342- type_id : ast:: DefId ) {
6339+ /// Populates the type context with all the inherent implementations for
6340+ /// the given type if necessary.
6341+ pub fn populate_inherent_implementations_for_type_if_necessary ( tcx : & ctxt ,
6342+ type_id : ast:: DefId ) {
63436343 if type_id. krate == LOCAL_CRATE {
63446344 return
63456345 }
@@ -6348,37 +6348,15 @@ pub fn populate_implementations_for_type_if_necessary(tcx: &ctxt,
63486348 return
63496349 }
63506350
6351- debug ! ( "populate_implementations_for_type_if_necessary : searching for {:?}" , type_id) ;
6351+ debug ! ( "populate_inherent_implementations_for_type_if_necessary : searching for {:?}" , type_id) ;
63526352
63536353 let mut inherent_impls = Vec :: new ( ) ;
6354- csearch:: each_implementation_for_type ( & tcx. sess . cstore , type_id, |impl_def_id| {
6355- let impl_items = csearch:: get_impl_items ( & tcx. sess . cstore , impl_def_id) ;
6356-
6357- // Record the implementation, if needed
6358- if let Some ( trait_ref) = csearch:: get_impl_trait ( tcx, impl_def_id) {
6359- let trait_def = lookup_trait_def ( tcx, trait_ref. def_id ) ;
6360- trait_def. record_impl ( tcx, impl_def_id, trait_ref) ;
6361- } else {
6362- inherent_impls. push ( impl_def_id) ;
6363- }
6364-
6365- // For any methods that use a default implementation, add them to
6366- // the map. This is a bit unfortunate.
6367- for impl_item_def_id in & impl_items {
6368- let method_def_id = impl_item_def_id. def_id ( ) ;
6369- match impl_or_trait_item ( tcx, method_def_id) {
6370- MethodTraitItem ( method) => {
6371- if let Some ( source) = method. provided_source {
6372- tcx. provided_method_sources
6373- . borrow_mut ( )
6374- . insert ( method_def_id, source) ;
6375- }
6376- }
6377- _ => { }
6378- }
6379- }
6354+ csearch:: each_inherent_implementation_for_type ( & tcx. sess . cstore , type_id, |impl_def_id| {
6355+ // Record the implementation.
6356+ inherent_impls. push ( impl_def_id) ;
63806357
63816358 // Store the implementation info.
6359+ let impl_items = csearch:: get_impl_items ( & tcx. sess . cstore , impl_def_id) ;
63826360 tcx. impl_items . borrow_mut ( ) . insert ( impl_def_id, impl_items) ;
63836361 } ) ;
63846362
0 commit comments