|
1 | 1 | use super::{
|
2 | 2 | mir::Safety,
|
3 | 3 | mir::{Body, Mutability},
|
4 |
| - with, AllocId, DefId, |
| 4 | + with, AllocId, DefId, Symbol, |
5 | 5 | };
|
6 | 6 | use crate::Opaque;
|
7 | 7 | use std::fmt::{self, Debug, Formatter};
|
@@ -34,7 +34,52 @@ pub struct Const {
|
34 | 34 | }
|
35 | 35 |
|
36 | 36 | type Ident = Opaque;
|
37 |
| -pub type Region = Opaque; |
| 37 | +pub(crate) struct Region { |
| 38 | + kind: RegionKind, |
| 39 | +} |
| 40 | + |
| 41 | +enum RegionKind { |
| 42 | + ReEarlyBound(EarlyBoundRegion), |
| 43 | + ReLateBound(DebruijnIndex, BoundRegion), |
| 44 | + ReFree(FreeRegion), |
| 45 | + ReStatic, |
| 46 | + ReVar(RegionVid), |
| 47 | + RePlaceholder(Placeholder<BoundRegion>), |
| 48 | + ReErased, |
| 49 | + ReError(ErrorGuaranteed), |
| 50 | +} |
| 51 | + |
| 52 | +pub(crate) type DebruijnIndex = u32; |
| 53 | + |
| 54 | +pub struct EarlyBoundRegion { |
| 55 | + pub def_id: DefId, |
| 56 | + pub index: u32, |
| 57 | + pub name: Symbol, |
| 58 | +} |
| 59 | + |
| 60 | +pub(crate) type BoundVar = u32; |
| 61 | + |
| 62 | +pub struct BoundRegion { |
| 63 | + pub var: BoundVar, |
| 64 | + pub kind: BoundRegionKind, |
| 65 | +} |
| 66 | + |
| 67 | +pub struct FreeRegion { |
| 68 | + pub scope: DefId, |
| 69 | + pub bound_region: BoundRegionKind, |
| 70 | +} |
| 71 | + |
| 72 | +pub(crate) type RegionVid = u32; |
| 73 | + |
| 74 | +pub(crate) type UniverseIndex = u32; |
| 75 | + |
| 76 | +pub struct Placeholder<T> { |
| 77 | + pub universe: UniverseIndex, |
| 78 | + pub bound: T, |
| 79 | +} |
| 80 | + |
| 81 | +pub(crate) type ErrorGuaranteed = (); |
| 82 | + |
38 | 83 | #[derive(Clone, Copy, PartialEq, Eq)]
|
39 | 84 | pub struct Span(pub usize);
|
40 | 85 |
|
|
0 commit comments