@@ -144,8 +144,7 @@ pub mod method;
144144pub struct SelfInfo {
145145 self_ty : ty:: t ,
146146 self_id : ast:: node_id ,
147- def_id : ast:: def_id ,
148- explicit_self : ast:: self_ty
147+ span : span
149148}
150149
151150/// Fields that are part of a `FnCtxt` which are inherited by
@@ -339,25 +338,6 @@ pub fn check_fn(ccx: @mut CrateCtxt,
339338 }
340339 } ;
341340
342- // Update the SelfInfo to contain an accurate self type (taking
343- // into account explicit self).
344- let self_info = do self_info. chain_ref |self_info| {
345- // If the self type is sty_static, we don't have a self ty.
346- if self_info. explicit_self . node == ast:: sty_static {
347- None
348- } else {
349- let in_scope_regions = fcx. in_scope_regions ;
350- let self_region = in_scope_regions. find ( ty:: br_self) ;
351- let ty = method:: transform_self_type_for_method (
352- fcx. tcx ( ) ,
353- self_region,
354- self_info. self_ty ,
355- self_info. explicit_self . node ,
356- TransformTypeNormally ) ;
357- Some ( SelfInfo { self_ty : ty, .. * self_info } )
358- }
359- } ;
360-
361341 gather_locals ( fcx, decl, body, arg_tys, self_info) ;
362342 check_block ( fcx, body) ;
363343
@@ -495,20 +475,25 @@ pub fn check_fn(ccx: @mut CrateCtxt,
495475
496476pub fn check_method ( ccx : @mut CrateCtxt ,
497477 method : @ast:: method ,
498- self_ty : ty:: t ,
499- self_impl_def_id : ast:: def_id ) {
500- let self_info = SelfInfo {
501- self_ty : self_ty,
502- self_id : method. self_id ,
503- def_id : self_impl_def_id,
504- explicit_self : method. self_ty
478+ self_ty : ty:: t )
479+ {
480+ let self_info = if method. self_ty . node == ast:: sty_static { None } else {
481+ let ty = method:: transform_self_type_for_method (
482+ ccx. tcx ,
483+ Some ( ty:: re_bound ( ty:: br_self) ) ,
484+ self_ty,
485+ method. self_ty . node ,
486+ TransformTypeNormally ) ;
487+ Some ( SelfInfo { self_ty : ty, self_id : method. self_id ,
488+ span : method. self_ty . span } )
505489 } ;
490+
506491 check_bare_fn (
507492 ccx,
508493 & method. decl ,
509494 & method. body ,
510495 method. id ,
511- Some ( self_info)
496+ self_info
512497 ) ;
513498}
514499
@@ -545,11 +530,7 @@ pub fn check_struct(ccx: @mut CrateCtxt,
545530 let class_t = SelfInfo {
546531 self_ty : self_ty,
547532 self_id : dtor. node . self_id ,
548- def_id : local_def ( id) ,
549- explicit_self : spanned {
550- node : ast:: sty_by_ref,
551- span : codemap:: dummy_sp ( )
552- }
533+ span : dtor. span ,
553534 } ;
554535 // typecheck the dtor
555536 let dtor_dec = ast_util:: dtor_dec ( ) ;
@@ -589,7 +570,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
589570 * ccx. tcx. sess. str_of( it. ident) , it. id, rp) ;
590571 let self_ty = ccx. to_ty ( & rscope:: type_rscope ( rp) , ty) ;
591572 for ms. each |m| {
592- check_method ( ccx, * m, self_ty, local_def ( it . id ) ) ;
573+ check_method ( ccx, * m, self_ty) ;
593574 }
594575 }
595576 ast:: item_trait( _, _, ref trait_methods) => {
@@ -601,7 +582,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
601582 }
602583 provided( m) => {
603584 let self_ty = ty:: mk_self ( ccx. tcx , local_def ( it. id ) ) ;
604- check_method ( ccx, m, self_ty, local_def ( it . id ) ) ;
585+ check_method ( ccx, m, self_ty) ;
605586 }
606587 }
607588 }
0 commit comments