@@ -53,10 +53,9 @@ use middle::const_eval;
5353use middle:: def;
5454use middle:: lang_items:: FnMutTraitLangItem ;
5555use rl = middle:: resolve_lifetime;
56- use middle:: subst:: { Subst , Substs } ;
57- use middle:: subst;
58- use middle:: ty:: ty_param_substs_and_ty;
56+ use middle:: subst:: { FnSpace , TypeSpace , SelfSpace , Subst , Substs } ;
5957use middle:: ty;
58+ use middle:: typeck:: TypeAndSubsts ;
6059use middle:: typeck:: lookup_def_tcx;
6160use middle:: typeck:: rscope:: RegionScope ;
6261use middle:: typeck:: rscope;
@@ -71,7 +70,7 @@ use syntax::print::pprust::{lifetime_to_str, path_to_str};
7170
7271pub trait AstConv {
7372 fn tcx < ' a > ( & ' a self ) -> & ' a ty:: ctxt ;
74- fn get_item_ty ( & self , id : ast:: DefId ) -> ty:: ty_param_bounds_and_ty ;
73+ fn get_item_ty ( & self , id : ast:: DefId ) -> ty:: Polytype ;
7574 fn get_trait_def ( & self , id : ast:: DefId ) -> Rc < ty:: TraitDef > ;
7675
7776 // what type should we use when a type is omitted?
@@ -154,7 +153,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
154153 rscope : & RS ,
155154 decl_generics : & ty:: Generics ,
156155 self_ty : Option < ty:: t > ,
157- path : & ast:: Path ) -> subst :: Substs
156+ path : & ast:: Path ) -> Substs
158157{
159158 /*!
160159 * Given a path `path` that refers to an item `I` with the
@@ -172,13 +171,13 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
172171 // Note: in the case of traits, the self parameter is also
173172 // defined, but we don't currently create a `type_param_def` for
174173 // `Self` because it is implicit.
175- assert ! ( decl_generics. regions. all( |d| d. space == subst :: TypeSpace ) ) ;
176- assert ! ( decl_generics. types. all( |d| d. space != subst :: FnSpace ) ) ;
174+ assert ! ( decl_generics. regions. all( |d| d. space == TypeSpace ) ) ;
175+ assert ! ( decl_generics. types. all( |d| d. space != FnSpace ) ) ;
177176
178177 // If the type is parameterized by the this region, then replace this
179178 // region with the current anon region binding (in other words,
180179 // whatever & would get replaced with).
181- let expected_num_region_params = decl_generics. regions . len ( subst :: TypeSpace ) ;
180+ let expected_num_region_params = decl_generics. regions . len ( TypeSpace ) ;
182181 let supplied_num_region_params = path. segments . last ( ) . unwrap ( ) . lifetimes . len ( ) ;
183182 let regions = if expected_num_region_params == supplied_num_region_params {
184183 path. segments . last ( ) . unwrap ( ) . lifetimes . iter ( ) . map (
@@ -204,7 +203,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
204203 } ;
205204
206205 // Convert the type parameters supplied by the user.
207- let ty_param_defs = decl_generics. types . get_vec ( subst :: TypeSpace ) ;
206+ let ty_param_defs = decl_generics. types . get_vec ( TypeSpace ) ;
208207 let supplied_ty_param_count = path. segments . iter ( ) . flat_map ( |s| s. types . iter ( ) ) . count ( ) ;
209208 let formal_ty_param_count = ty_param_defs. len ( ) ;
210209 let required_ty_param_count = ty_param_defs. iter ( )
@@ -246,7 +245,7 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
246245 . map ( |a_t| ast_ty_to_ty ( this, rscope, & * * a_t) )
247246 . collect ( ) ;
248247
249- let mut substs = subst :: Substs :: new_type ( tps, regions) ;
248+ let mut substs = Substs :: new_type ( tps, regions) ;
250249
251250 match self_ty {
252251 None => {
@@ -258,14 +257,14 @@ fn ast_path_substs<AC:AstConv,RS:RegionScope>(
258257 // "declared" (in other words, this should be a
259258 // trait-ref).
260259 assert ! ( decl_generics. types. get_self( ) . is_some( ) ) ;
261- substs. types . push ( subst :: SelfSpace , ty) ;
260+ substs. types . push ( SelfSpace , ty) ;
262261 }
263262 }
264263
265264 for param in ty_param_defs. slice_from ( supplied_ty_param_count) . iter ( ) {
266265 let default = param. default . unwrap ( ) ;
267266 let default = default. subst_spanned ( tcx, & substs, Some ( path. span ) ) ;
268- substs. types . push ( subst :: TypeSpace , default) ;
267+ substs. types . push ( TypeSpace , default) ;
269268 }
270269
271270 substs
@@ -289,17 +288,17 @@ pub fn ast_path_to_ty<AC:AstConv,RS:RegionScope>(
289288 rscope : & RS ,
290289 did : ast:: DefId ,
291290 path : & ast:: Path )
292- -> ty_param_substs_and_ty
291+ -> TypeAndSubsts
293292{
294293 let tcx = this. tcx ( ) ;
295- let ty:: ty_param_bounds_and_ty {
294+ let ty:: Polytype {
296295 generics : generics,
297296 ty : decl_ty
298297 } = this. get_item_ty ( did) ;
299298
300299 let substs = ast_path_substs ( this, rscope, & generics, None , path) ;
301300 let ty = decl_ty. subst ( tcx, & substs) ;
302- ty_param_substs_and_ty { substs : substs, ty : ty }
301+ TypeAndSubsts { substs : substs, ty : ty }
303302}
304303
305304pub static NO_REGIONS : uint = 1 ;
@@ -547,11 +546,11 @@ pub fn trait_ref_for_unboxed_function<AC:AstConv,
547546 let output_type = ast_ty_to_ty ( this,
548547 rscope,
549548 & * unboxed_function. decl . output ) ;
550- let mut substs = subst :: Substs :: new_type ( vec ! ( input_tuple, output_type) ,
549+ let mut substs = Substs :: new_type ( vec ! ( input_tuple, output_type) ,
551550 Vec :: new ( ) ) ;
552551
553552 match self_ty {
554- Some ( s) => substs. types . push ( subst :: SelfSpace , s) ,
553+ Some ( s) => substs. types . push ( SelfSpace , s) ,
555554 None => ( )
556555 }
557556
0 commit comments