pub struct TypeContext { /* private fields */ }Expand description
Per-inference-run state: the level stack for generalization, and a
counter for fresh variable ids (see FRESH_ID’s doc comment for why
instantiate/unify use a different counter than this one — the two
never need to agree, since identity is always by pointer).
Implementations§
Source§impl TypeContext
impl TypeContext
pub fn new() -> Self
pub fn level(&self) -> u32
Sourcepub fn enter_level(&mut self)
pub fn enter_level(&mut self)
Enter a new let-nesting level. Call before inferring the
right-hand side of a let.
Sourcepub fn leave_level(&mut self)
pub fn leave_level(&mut self)
Leave the current level. Call after inferring the right-hand side
of a let, before calling generalize.
pub fn fresh_var(&mut self) -> TyVarRef
pub fn fresh_var_with_kind(&mut self, kind: Kind) -> TyVarRef
pub fn fresh_row_var(&mut self) -> RowVarRef
pub fn fresh_row_var_with_kind(&mut self, kind: BTreeSet<String>) -> RowVarRef
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypeContext
impl RefUnwindSafe for TypeContext
impl Send for TypeContext
impl Sync for TypeContext
impl Unpin for TypeContext
impl UnsafeUnpin for TypeContext
impl UnwindSafe for TypeContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more