@@ -55,18 +55,17 @@ impl<'tcx> Substs<'tcx> {
55
55
r : Vec < ty:: Region > )
56
56
-> Substs < ' tcx >
57
57
{
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 ( ) ) )
60
60
}
61
61
62
62
pub fn new_trait ( t : Vec < Ty < ' tcx > > ,
63
63
r : Vec < ty:: Region > ,
64
- a : Vec < Ty < ' tcx > > ,
65
64
s : Ty < ' tcx > )
66
65
-> Substs < ' tcx >
67
66
{
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 ( ) ) )
70
69
}
71
70
72
71
pub fn erased ( t : VecPerParamSpace < Ty < ' tcx > > ) -> Substs < ' tcx >
@@ -123,13 +122,6 @@ impl<'tcx> Substs<'tcx> {
123
122
s
124
123
}
125
124
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
-
133
125
pub fn erase_regions ( self ) -> Substs < ' tcx > {
134
126
let Substs { types, regions : _ } = self ;
135
127
Substs { types : types, regions : ErasedRegions }
@@ -192,30 +184,27 @@ impl RegionSubsts {
192
184
pub enum ParamSpace {
193
185
TypeSpace , // Type parameters attached to a type definition, trait, or impl
194
186
SelfSpace , // Self parameter on a trait
195
- AssocSpace , // Assoc types defined in a trait/impl
196
187
FnSpace , // Type parameters attached to a method or fn
197
188
}
198
189
199
190
impl ParamSpace {
200
- pub fn all ( ) -> [ ParamSpace , ..4 ] {
201
- [ TypeSpace , SelfSpace , AssocSpace , FnSpace ]
191
+ pub fn all ( ) -> [ ParamSpace , ..3 ] {
192
+ [ TypeSpace , SelfSpace , FnSpace ]
202
193
}
203
194
204
195
pub fn to_uint ( self ) -> uint {
205
196
match self {
206
197
TypeSpace => 0 ,
207
198
SelfSpace => 1 ,
208
- AssocSpace => 2 ,
209
- FnSpace => 3 ,
199
+ FnSpace => 2 ,
210
200
}
211
201
}
212
202
213
203
pub fn from_uint ( u : uint ) -> ParamSpace {
214
204
match u {
215
205
0 => TypeSpace ,
216
206
1 => SelfSpace ,
217
- 2 => AssocSpace ,
218
- 3 => FnSpace ,
207
+ 2 => FnSpace ,
219
208
_ => panic ! ( "Invalid ParamSpace: {}" , u)
220
209
}
221
210
}
@@ -235,11 +224,9 @@ pub struct VecPerParamSpace<T> {
235
224
//
236
225
// AF(self) = (self.content[..self.type_limit],
237
226
// 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..])
240
228
type_limit : uint ,
241
229
self_limit : uint ,
242
- assoc_limit : uint ,
243
230
content : Vec < T > ,
244
231
}
245
232
@@ -248,7 +235,6 @@ pub struct VecPerParamSpace<T> {
248
235
pub struct SeparateVecsPerParamSpace < T > {
249
236
pub types : Vec < T > ,
250
237
pub selfs : Vec < T > ,
251
- pub assocs : Vec < T > ,
252
238
pub fns : Vec < T > ,
253
239
}
254
240
@@ -268,16 +254,14 @@ impl<T> VecPerParamSpace<T> {
268
254
match space {
269
255
TypeSpace => ( 0 , self . type_limit ) ,
270
256
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 ( ) ) ,
273
258
}
274
259
}
275
260
276
261
pub fn empty ( ) -> VecPerParamSpace < T > {
277
262
VecPerParamSpace {
278
263
type_limit : 0 ,
279
264
self_limit : 0 ,
280
- assoc_limit : 0 ,
281
265
content : Vec :: new ( )
282
266
}
283
267
}
@@ -290,31 +274,27 @@ impl<T> VecPerParamSpace<T> {
290
274
/// `s` is the self space.
291
275
/// `a` is the assoc space.
292
276
/// `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 > {
294
278
let type_limit = t. len ( ) ;
295
279
let self_limit = type_limit + s. len ( ) ;
296
- let assoc_limit = self_limit + a. len ( ) ;
297
280
298
281
let mut content = t;
299
282
content. extend ( s. into_iter ( ) ) ;
300
- content. extend ( a. into_iter ( ) ) ;
301
283
content. extend ( f. into_iter ( ) ) ;
302
284
303
285
VecPerParamSpace {
304
286
type_limit : type_limit,
305
287
self_limit : self_limit,
306
- assoc_limit : assoc_limit,
307
288
content : content,
308
289
}
309
290
}
310
291
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 )
312
293
-> VecPerParamSpace < T >
313
294
{
314
295
VecPerParamSpace {
315
296
type_limit : type_limit,
316
297
self_limit : self_limit,
317
- assoc_limit : assoc_limit,
318
298
content : content,
319
299
}
320
300
}
@@ -326,9 +306,8 @@ impl<T> VecPerParamSpace<T> {
326
306
pub fn push ( & mut self , space : ParamSpace , value : T ) {
327
307
let ( _, limit) = self . limits ( space) ;
328
308
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 ; }
332
311
FnSpace => { }
333
312
}
334
313
self . content . insert ( limit, value) ;
@@ -340,9 +319,8 @@ impl<T> VecPerParamSpace<T> {
340
319
None
341
320
} else {
342
321
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 ; }
346
324
FnSpace => { }
347
325
}
348
326
self . content . remove ( limit - 1 )
@@ -439,8 +417,7 @@ impl<T> VecPerParamSpace<T> {
439
417
let result = self . iter ( ) . map ( pred) . collect ( ) ;
440
418
VecPerParamSpace :: new_internal ( result,
441
419
self . type_limit ,
442
- self . self_limit ,
443
- self . assoc_limit )
420
+ self . self_limit )
444
421
}
445
422
446
423
pub fn map_enumerated < U , P > ( & self , pred : P ) -> VecPerParamSpace < U > where
@@ -449,8 +426,7 @@ impl<T> VecPerParamSpace<T> {
449
426
let result = self . iter_enumerated ( ) . map ( pred) . collect ( ) ;
450
427
VecPerParamSpace :: new_internal ( result,
451
428
self . type_limit ,
452
- self . self_limit ,
453
- self . assoc_limit )
429
+ self . self_limit )
454
430
}
455
431
456
432
pub fn map_move < U , F > ( self , mut pred : F ) -> VecPerParamSpace < U > where
@@ -459,25 +435,22 @@ impl<T> VecPerParamSpace<T> {
459
435
let SeparateVecsPerParamSpace {
460
436
types : t,
461
437
selfs : s,
462
- assocs : a,
463
438
fns : f
464
439
} = self . split ( ) ;
465
440
466
441
VecPerParamSpace :: new ( t. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
467
442
s. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
468
- a. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) ,
469
443
f. into_iter ( ) . map ( |p| pred ( p) ) . collect ( ) )
470
444
}
471
445
472
446
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 ;
474
448
475
449
let mut content_iter = content. into_iter ( ) ;
476
450
477
451
SeparateVecsPerParamSpace {
478
452
types : content_iter. by_ref ( ) . take ( type_limit) . collect ( ) ,
479
453
selfs : content_iter. by_ref ( ) . take ( self_limit - type_limit) . collect ( ) ,
480
- assocs : content_iter. by_ref ( ) . take ( assoc_limit - self_limit) . collect ( ) ,
481
454
fns : content_iter. collect ( )
482
455
}
483
456
}
0 commit comments