[−][src]Struct rustc_trait_selection::infer::type_variable::TypeVariableStorage

pub struct TypeVariableStorage<'tcx> {
    pub(in infer::type_variable) values: SnapshotVec<Delegate, Vec<<Delegate as SnapshotVecDelegate>::Value>, ()>,
    pub(in infer::type_variable) eq_relations: UnificationTable<InPlace<TyVidEqKey<'tcx>, Vec<VarValue<TyVidEqKey<'tcx>>>, ()>>,
    pub(in infer::type_variable) sub_relations: UnificationTable<InPlace<TyVid, Vec<VarValue<TyVid>>, ()>>,
}

Fields

values: SnapshotVec<Delegate, Vec<<Delegate as SnapshotVecDelegate>::Value>, ()>eq_relations: UnificationTable<InPlace<TyVidEqKey<'tcx>, Vec<VarValue<TyVidEqKey<'tcx>>>, ()>>

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: UnificationTable<InPlace<TyVid, Vec<VarValue<TyVid>>, ()>>

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.

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> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]