@@ -300,13 +300,8 @@ impl<'self> LookupContext<'self> {
300
300
ty_self( self_did) => {
301
301
// Call is of the form "self.foo()" and appears in one
302
302
// of a trait's default method implementations.
303
- let substs = substs {
304
- self_r : None ,
305
- self_ty : None ,
306
- tps : ~[ ]
307
- } ;
308
303
self . push_inherent_candidates_from_self (
309
- self_ty, self_did, & substs ) ;
304
+ self_ty, self_did) ;
310
305
}
311
306
ty_enum( did, _) | ty_struct( did, _) => {
312
307
if self . check_traits == CheckTraitsAndInherentMethods {
@@ -462,12 +457,12 @@ impl<'self> LookupContext<'self> {
462
457
463
458
pub fn push_inherent_candidates_from_self( & self ,
464
459
self_ty: ty:: t,
465
- did: def_id,
466
- substs: & ty:: substs) {
460
+ did: def_id) {
467
461
struct MethodInfo {
468
462
method_ty : @ty:: Method ,
469
463
trait_def_id : ast:: def_id,
470
- index : uint
464
+ index : uint,
465
+ trait_ref : @ty:: TraitRef
471
466
}
472
467
473
468
let tcx = self . tcx( ) ;
@@ -479,7 +474,8 @@ impl<'self> LookupContext<'self> {
479
474
method_info = Some ( MethodInfo {
480
475
method_ty : methods[ i] ,
481
476
index : i,
482
- trait_def_id : did
477
+ trait_def_id : did,
478
+ trait_ref : ty:: lookup_trait_def( tcx, did) . trait_ref
483
479
} ) ;
484
480
}
485
481
None => ( )
@@ -494,7 +490,8 @@ impl<'self> LookupContext<'self> {
494
490
method_info = Some ( MethodInfo {
495
491
method_ty : supertrait_methods[ i] ,
496
492
index : i,
497
- trait_def_id : trait_ref. def_id
493
+ trait_def_id : trait_ref. def_id,
494
+ trait_ref : * trait_ref
498
495
} ) ;
499
496
break ;
500
497
}
@@ -505,16 +502,14 @@ impl<'self> LookupContext<'self> {
505
502
match method_info {
506
503
Some ( ref info) => {
507
504
// We've found a method -- return it
508
- let rcvr_substs = substs { self_ty : Some ( self_ty) ,
509
- ..copy * substs } ;
510
505
let origin = if did == info. trait_def_id {
511
506
method_self( info. trait_def_id, info. index)
512
507
} else {
513
508
method_super( info. trait_def_id, info. index)
514
509
} ;
515
510
self . inherent_candidates. push( Candidate {
516
511
rcvr_ty : self_ty,
517
- rcvr_substs : rcvr_substs ,
512
+ rcvr_substs : copy info . trait_ref . substs ,
518
513
method_ty : info. method_ty,
519
514
origin : origin
520
515
} ) ;
0 commit comments