@@ -300,13 +300,8 @@ impl<'self> LookupContext<'self> {
300300 ty_self( self_did) => {
301301 // Call is of the form "self.foo()" and appears in one
302302 // of a trait's default method implementations.
303- let substs = substs {
304- self_r : None ,
305- self_ty : None ,
306- tps : ~[ ]
307- } ;
308303 self . push_inherent_candidates_from_self (
309- self_ty, self_did, & substs ) ;
304+ self_ty, self_did) ;
310305 }
311306 ty_enum( did, _) | ty_struct( did, _) => {
312307 if self . check_traits == CheckTraitsAndInherentMethods {
@@ -462,12 +457,12 @@ impl<'self> LookupContext<'self> {
462457
463458 pub fn push_inherent_candidates_from_self( & self ,
464459 self_ty: ty:: t,
465- did: def_id,
466- substs: & ty:: substs) {
460+ did: def_id) {
467461 struct MethodInfo {
468462 method_ty : @ty:: Method ,
469463 trait_def_id : ast:: def_id,
470- index : uint
464+ index : uint,
465+ trait_ref : @ty:: TraitRef
471466 }
472467
473468 let tcx = self . tcx( ) ;
@@ -479,7 +474,8 @@ impl<'self> LookupContext<'self> {
479474 method_info = Some ( MethodInfo {
480475 method_ty : methods[ i] ,
481476 index : i,
482- trait_def_id : did
477+ trait_def_id : did,
478+ trait_ref : ty:: lookup_trait_def( tcx, did) . trait_ref
483479 } ) ;
484480 }
485481 None => ( )
@@ -494,7 +490,8 @@ impl<'self> LookupContext<'self> {
494490 method_info = Some ( MethodInfo {
495491 method_ty : supertrait_methods[ i] ,
496492 index : i,
497- trait_def_id : trait_ref. def_id
493+ trait_def_id : trait_ref. def_id,
494+ trait_ref : * trait_ref
498495 } ) ;
499496 break ;
500497 }
@@ -505,16 +502,14 @@ impl<'self> LookupContext<'self> {
505502 match method_info {
506503 Some ( ref info) => {
507504 // We've found a method -- return it
508- let rcvr_substs = substs { self_ty : Some ( self_ty) ,
509- ..copy * substs } ;
510505 let origin = if did == info. trait_def_id {
511506 method_self( info. trait_def_id, info. index)
512507 } else {
513508 method_super( info. trait_def_id, info. index)
514509 } ;
515510 self . inherent_candidates. push( Candidate {
516511 rcvr_ty : self_ty,
517- rcvr_substs : rcvr_substs ,
512+ rcvr_substs : copy info . trait_ref . substs ,
518513 method_ty : info. method_ty,
519514 origin : origin
520515 } ) ;
0 commit comments