diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-08-27 09:31:14 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-27 09:31:14 +0530 |
| commit | 7a2a381e0e8d127c44702d79dd697e15685454e2 (patch) | |
| tree | e9dee807716e8c81208fab2bc4b22d2e2edd9eb6 /src/test/incremental/thinlto | |
| parent | 1385feb5eecd50c31d97229ffe3d751050d89733 (diff) | |
| parent | 7a8d4822d8eb922f0cd50e92f420b5f1938db64d (diff) | |
| download | rust-7a2a381e0e8d127c44702d79dd697e15685454e2.tar.gz rust-7a2a381e0e8d127c44702d79dd697e15685454e2.zip | |
Rollup merge of #36002 - eddyb:abstract-kindness, r=nikomatsakis
Combine types and regions in Substs into one interleaved list.
Previously, `Substs` would contain types and regions, in two separate vectors, for example:
```rust
<X as Trait<'a, 'b, A, B>>::method::<'p, 'q, T, U>
/* corresponds to */
Substs { regions: ['a, 'b, 'p, 'q], types: [X, A, B, T, U] }
```
This PR continues the work started in #35605 by further removing the distinction.
A new abstraction over types and regions is introduced in the compiler, `Kind`.
Each `Kind` is a pointer (`&TyS` or `&Region`), with the lowest two bits used as a tag.
Two bits were used instead of just one (type = `0`, region = `1`) to allow adding more kinds.
`Substs` contain only a `Vec<Kind>`, with `Self` first, followed by regions and types (in the definition order):
```rust
Substs { params: [X, 'a, 'b, A, B, 'p, 'q, T, U] }
```
The resulting interleaved list has the property of being the concatenation of parameters for the (potentially) nested generic items it describes, and can be sliced back into those components:
```rust
params[0..5] = [X, 'a, 'b, A, B] // <X as Trait<'a, 'b, A, B>>
params[5..9] = ['p, 'q, T, U] // <_>::method::<'p, 'q, T, U>
```
r? @nikomatsakis
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions
