Struct rustc_infer::infer::type_variable::TypeVariableStorage [−][src]
pub struct TypeVariableStorage<'tcx> {
values: SnapshotVecStorage<Delegate>,
eq_relations: UnificationTableStorage<TyVidEqKey<'tcx>>,
sub_relations: UnificationTableStorage<TyVid>,
}Fields
values: SnapshotVecStorage<Delegate>eq_relations: UnificationTableStorage<TyVidEqKey<'tcx>>Expand description
Two variables are unified in eq_relations when we have a
constraint ?X == ?Y. This table also stores, for each key,
the known value.
sub_relations: UnificationTableStorage<TyVid>Expand description
Two variables are unified in sub_relations when we have a
constraint ?X <: ?Y or a constraint ?Y <: ?X. This second
table exists only to help with the occurs check. In particular,
we want to report constraints like these as an occurs check
violation:
?1 <: ?3 Box<?3> <: ?1
This works because ?1 and ?3 are unified in the
sub_relations relation (not in eq_relations). Then when we
process the Box<?3> <: ?1 constraint, we do an occurs check
on Box<?3> and find a potential cycle.
This is reasonable because, in Rust, subtypes have the same
“skeleton” and hence there is no possible type such that
(e.g.) Box<?3> <: ?3 for any ?3.
Implementations
impl<'tcx> TypeVariableStorage<'tcx>[src]
impl<'tcx> TypeVariableStorage<'tcx>[src]pub fn new() -> TypeVariableStorage<'tcx>[src]
pub(crate) fn with_log<'a>(
&'a mut self,
undo_log: &'a mut InferCtxtUndoLogs<'tcx>
) -> TypeVariableTable<'a, 'tcx>[src]
&'a mut self,
undo_log: &'a mut InferCtxtUndoLogs<'tcx>
) -> TypeVariableTable<'a, 'tcx>
Trait Implementations
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for TypeVariableStorage<'tcx>
impl<'tcx> !Send for TypeVariableStorage<'tcx>
impl<'tcx> !Sync for TypeVariableStorage<'tcx>
impl<'tcx> Unpin for TypeVariableStorage<'tcx>
impl<'tcx> !UnwindSafe for TypeVariableStorage<'tcx>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> WithConstness for T[src]
impl<T> WithConstness for T[src]fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]
fn with_const(self) -> ConstnessAnd<Self>[src]
fn without_const(self) -> ConstnessAnd<Self>[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,