@@ -55,18 +55,17 @@ impl<'tcx> Substs<'tcx> {
5555 r : Vec < ty:: Region > )
5656 -> Substs < ' tcx >
5757 {
58- Substs :: new ( VecPerParamSpace :: new ( t, Vec :: new ( ) , Vec :: new ( ) , Vec :: new ( ) ) ,
59- VecPerParamSpace :: new ( r, Vec :: new ( ) , Vec :: new ( ) , Vec :: new ( ) ) )
58+ Substs :: new ( VecPerParamSpace :: new ( t, Vec :: new ( ) , Vec :: new ( ) ) ,
59+ VecPerParamSpace :: new ( r, Vec :: new ( ) , Vec :: new ( ) ) )
6060 }
6161
6262 pub fn new_trait ( t : Vec < Ty < ' tcx > > ,
6363 r : Vec < ty:: Region > ,
64- a : Vec < Ty < ' tcx > > ,
6564 s : Ty < ' tcx > )
6665 -> Substs < ' tcx >
6766 {
68- Substs :: new ( VecPerParamSpace :: new ( t, vec ! ( s) , a , Vec :: new ( ) ) ,
69- VecPerParamSpace :: new ( r, Vec :: new ( ) , Vec :: new ( ) , Vec :: new ( ) ) )
67+ Substs :: new ( VecPerParamSpace :: new ( t, vec ! ( s) , Vec :: new ( ) ) ,
68+ VecPerParamSpace :: new ( r, Vec :: new ( ) , Vec :: new ( ) ) )
7069 }
7170
7271 pub fn erased ( t : VecPerParamSpace < Ty < ' tcx > > ) -> Substs < ' tcx >
@@ -123,13 +122,6 @@ impl<'tcx> Substs<'tcx> {
123122 s
124123 }
125124
126- pub fn with_assoc_tys ( & self , assoc_tys : Vec < Ty < ' tcx > > ) -> Substs < ' tcx > {
127- assert ! ( self . types. is_empty_in( AssocSpace ) ) ;
128- let mut s = ( * self ) . clone ( ) ;
129- s. types . replace ( AssocSpace , assoc_tys) ;
130- s
131- }
132-
133125 pub fn erase_regions ( self ) -> Substs < ' tcx > {
134126 let Substs { types, regions : _ } = self ;
135127 Substs { types : types, regions : ErasedRegions }
@@ -192,30 +184,27 @@ impl RegionSubsts {
192184pub enum ParamSpace {
193185 TypeSpace , // Type parameters attached to a type definition, trait, or impl
194186 SelfSpace , // Self parameter on a trait
195- AssocSpace , // Assoc types defined in a trait/impl
196187 FnSpace , // Type parameters attached to a method or fn
197188}
198189
199190impl ParamSpace {
200- pub fn all ( ) -> [ ParamSpace , ..4 ] {
201- [ TypeSpace , SelfSpace , AssocSpace , FnSpace ]
191+ pub fn all ( ) -> [ ParamSpace , ..3 ] {
192+ [ TypeSpace , SelfSpace , FnSpace ]
202193 }
203194
204195 pub fn to_uint ( self ) -> uint {
205196 match self {
206197 TypeSpace => 0 ,
207198 SelfSpace => 1 ,
208- AssocSpace => 2 ,
209- FnSpace => 3 ,
199+ FnSpace => 2 ,
210200 }
211201 }
212202
213203 pub fn from_uint ( u : uint ) -> ParamSpace {
214204 match u {
215205 0 => TypeSpace ,
216206 1 => SelfSpace ,
217- 2 => AssocSpace ,
218- 3 => FnSpace ,
207+ 2 => FnSpace ,
219208 _ => panic ! ( "Invalid ParamSpace: {}" , u)
220209 }
221210 }
@@ -235,11 +224,9 @@ pub struct VecPerParamSpace<T> {
235224 //
236225 // AF(self) = (self.content[..self.type_limit],
237226 // self.content[self.type_limit..self.self_limit],
238- // self.content[self.self_limit..self.assoc_limit],
239- // self.content[self.assoc_limit..])
227+ // self.content[self.self_limit..])
240228 type_limit : uint ,
241229 self_limit : uint ,
242- assoc_limit : uint ,
243230 content : Vec < T > ,
244231}
245232
@@ -248,7 +235,6 @@ pub struct VecPerParamSpace<T> {
248235pub struct SeparateVecsPerParamSpace < T > {
249236 pub types : Vec < T > ,
250237 pub selfs : Vec < T > ,
251- pub assocs : Vec < T > ,
252238 pub fns : Vec < T > ,
253239}
254240
@@ -268,16 +254,14 @@ impl<T> VecPerParamSpace<T> {
268254 match space {
269255 TypeSpace => ( 0 , self . type_limit ) ,
270256 SelfSpace => ( self . type_limit , self . self_limit ) ,
271- AssocSpace => ( self . self_limit , self . assoc_limit ) ,
272- FnSpace => ( self . assoc_limit , self . content . len ( ) ) ,
257+ FnSpace => ( self . self_limit , self . content . len ( ) ) ,
273258 }
274259 }
275260
276261 pub fn empty ( ) -> VecPerParamSpace < T > {
277262 VecPerParamSpace {
278263 type_limit : 0 ,
279264 self_limit : 0 ,
280- assoc_limit : 0 ,
281265 content : Vec :: new ( )
282266 }
283267 }
@@ -290,31 +274,27 @@ impl<T> VecPerParamSpace<T> {
290274 /// `s` is the self space.
291275 /// `a` is the assoc space.
292276 /// `f` is the fn space.
293- pub fn new ( t : Vec < T > , s : Vec < T > , a : Vec < T > , f : Vec < T > ) -> VecPerParamSpace < T > {
277+ pub fn new ( t : Vec < T > , s : Vec < T > , f : Vec < T > ) -> VecPerParamSpace < T > {
294278 let type_limit = t. len ( ) ;
295279 let self_limit = type_limit + s. len ( ) ;
296- let assoc_limit = self_limit + a. len ( ) ;
297280
298281 let mut content = t;
299282 content. extend ( s. into_iter ( ) ) ;
300- content. extend ( a. into_iter ( ) ) ;
301283 content. extend ( f. into_iter ( ) ) ;
302284
303285 VecPerParamSpace {
304286 type_limit : type_limit,
305287 self_limit : self_limit,
306- assoc_limit : assoc_limit,
307288 content : content,
308289 }
309290 }
310291
311- fn new_internal ( content : Vec < T > , type_limit : uint , self_limit : uint , assoc_limit : uint )
292+ fn new_internal ( content : Vec < T > , type_limit : uint , self_limit : uint )
312293 -> VecPerParamSpace < T >
313294 {
314295 VecPerParamSpace {
315296 type_limit : type_limit,
316297 self_limit : self_limit,
317- assoc_limit : assoc_limit,
318298 content : content,
319299 }
320300 }
@@ -326,9 +306,8 @@ impl<T> VecPerParamSpace<T> {
326306 pub fn push ( & mut self , space : ParamSpace , value : T ) {
327307 let ( _, limit) = self . limits ( space) ;
328308 match space {
329- TypeSpace => { self . type_limit += 1 ; self . self_limit += 1 ; self . assoc_limit += 1 ; }
330- SelfSpace => { self . self_limit += 1 ; self . assoc_limit += 1 ; }
331- AssocSpace => { self . assoc_limit += 1 ; }
309+ TypeSpace => { self . type_limit += 1 ; self . self_limit += 1 ; }
310+ SelfSpace => { self . self_limit += 1 ; }
332311 FnSpace => { }
333312 }
334313 self . content . insert ( limit, value) ;
@@ -340,9 +319,8 @@ impl<T> VecPerParamSpace<T> {
340319 None
341320 } else {
342321 match space {
343- TypeSpace => { self . type_limit -= 1 ; self . self_limit -= 1 ; self . assoc_limit -= 1 ; }
344- SelfSpace => { self . self_limit -= 1 ; self . assoc_limit -= 1 ; }
345- AssocSpace => { self . assoc_limit -= 1 ; }
322+ TypeSpace => { self . type_limit -= 1 ; self . self_limit -= 1 ; }
323+ SelfSpace => { self . self_limit -= 1 ; }
346324 FnSpace => { }
347325 }
348326 self . content . remove ( limit - 1 )
@@ -439,8 +417,7 @@ impl<T> VecPerParamSpace<T> {
439417 let result = self . iter ( ) . map ( pred) . collect ( ) ;
440418 VecPerParamSpace :: new_internal ( result,
441419 self . type_limit ,
442- self . self_limit ,
443- self . assoc_limit )
420+ self . self_limit )
444421 }
445422
446423 pub fn map_enumerated < U , P > ( & self , pred : P ) -> VecPerParamSpace < U > where
@@ -449,8 +426,7 @@ impl<T> VecPerParamSpace<T> {
449426 let result = self . iter_enumerated ( ) . map ( pred) . collect ( ) ;
450427 VecPerParamSpace :: new_internal ( result,
451428 self . type_limit ,
452- self . self_limit ,
453- self . assoc_limit )
429+ self . self_limit )
454430 }
455431
456432 pub fn map_move < U , F > ( self , mut pred : F ) -> VecPerParamSpace < U > where
@@ -459,25 +435,22 @@ impl<T> VecPerParamSpace<T> {
459435 let SeparateVecsPerParamSpace {
460436 types : t,
461437 selfs : s,
462- assocs : a,
463438 fns : f
464439 } = self . split ( ) ;
465440
466441 VecPerParamSpace :: new ( t. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
467442 s. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
468- a. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
469443 f. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) )
470444 }
471445
472446 pub fn split ( self ) -> SeparateVecsPerParamSpace < T > {
473- let VecPerParamSpace { type_limit, self_limit, assoc_limit , content } = self ;
447+ let VecPerParamSpace { type_limit, self_limit, content } = self ;
474448
475449 let mut content_iter = content. into_iter ( ) ;
476450
477451 SeparateVecsPerParamSpace {
478452 types : content_iter. by_ref ( ) . take ( type_limit) . collect ( ) ,
479453 selfs : content_iter. by_ref ( ) . take ( self_limit - type_limit) . collect ( ) ,
480- assocs : content_iter. by_ref ( ) . take ( assoc_limit - self_limit) . collect ( ) ,
481454 fns : content_iter. collect ( )
482455 }
483456 }
0 commit comments