@@ -1064,44 +1064,7 @@ pub fn impl_self_ty(vcx: &VtableContext,
10641064 -> ty_param_substs_and_ty {
10651065 let tcx = vcx. tcx ( ) ;
10661066
1067- let ( n_tps, region_param, raw_ty) = if did. crate == ast:: local_crate {
1068- let region_param = tcx. region_paramd_items . find ( & did. node ) .
1069- map_consume ( |x| * x) ;
1070- match tcx. items . find ( & did. node ) {
1071- Some ( & ast_map:: node_item( @ast:: item {
1072- node : ast:: item_impl( ref ts, _, st, _) ,
1073- _
1074- } , _) ) => {
1075- let region_parameterization =
1076- RegionParameterization :: from_variance_and_generics (
1077- region_param,
1078- ts) ;
1079- ( ts. ty_params . len ( ) ,
1080- region_param,
1081- vcx. ccx . to_ty ( & rscope:: type_rscope ( region_parameterization) , st) )
1082- }
1083- Some ( & ast_map:: node_item( @ast:: item {
1084- node : ast:: item_struct( _, ref ts) ,
1085- id : class_id,
1086- _
1087- } , _) ) => {
1088- /* If the impl is a class, the self ty is just the class ty
1089- (doing a no-op subst for the ty params; in the next step,
1090- we substitute in fresh vars for them)
1091- */
1092- ( ts. ty_params . len ( ) ,
1093- region_param,
1094- ty:: mk_struct ( tcx, local_def ( class_id) ,
1095- substs {
1096- self_r : rscope:: bound_self_region ( region_param) ,
1097- self_ty : None ,
1098- tps : ty:: ty_params_to_tys ( tcx, ts)
1099- } ) )
1100- }
1101- _ => { tcx. sess . bug ( ~"impl_self_ty: unbound item or item that \
1102- doesn' t have a self_ty") ; }
1103- }
1104- } else {
1067+ let ( n_tps, region_param, raw_ty) = {
11051068 let ity = ty:: lookup_item_type ( tcx, did) ;
11061069 ( vec:: len ( * ity. bounds ) , ity. region_param , ity. ty )
11071070 } ;
0 commit comments