Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 02b01a4

Browse files
committed
make region struct and add neccesasry types
1 parent 46da927 commit 02b01a4

File tree

1 file changed

+47
-2
lines changed
  • compiler/stable_mir/src

1 file changed

+47
-2
lines changed

compiler/stable_mir/src/ty.rs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{
22
mir::Safety,
33
mir::{Body, Mutability},
4-
with, AllocId, DefId,
4+
with, AllocId, DefId, Symbol,
55
};
66
use crate::Opaque;
77
use std::fmt::{self, Debug, Formatter};
@@ -34,7 +34,52 @@ pub struct Const {
3434
}
3535

3636
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+
3883
#[derive(Clone, Copy, PartialEq, Eq)]
3984
pub struct Span(pub usize);
4085

0 commit comments

Comments
 (0)