[][src]Struct rustc::infer::type_variable::TypeVariableTable

pub struct TypeVariableTable<'tcx> {
    values: SnapshotVec<Delegate>,
    eq_relations: UnificationTable<InPlace<TyVidEqKey<'tcx>>>,
    sub_relations: UnificationTable<InPlace<TyVid>>,
}
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Fields

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Two variables are unified in eq_relations when we have a constraint ?X == ?Y. This table also stores, for each key, the known value.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Two variables are unified in eq_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.

Methods

impl<'tcx> TypeVariableTable<'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns the diverges flag given when vid was created.

Note that this function does not return care whether vid has been unified with something else or not.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns the origin that was given when vid was created.

Note that this function does not return care whether vid has been unified with something else or not.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Records that a == b, depending on dir.

Precondition: neither a nor b are known.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Records that a <: b, depending on dir.

Precondition: neither a nor b are known.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Instantiates vid with the type ty.

Precondition: vid must not have been previously instantiated.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Creates a new type variable.

  • diverging: indicates if this is a "diverging" type variable, e.g. one created as the type of a return expression. The code in this module doesn't care if a variable is diverging, but the main Rust type-checker will sometimes "unify" such variables with the ! or () types.
  • origin: indicates why the type variable was created. The code in this module doesn't care, but it can be useful for improving error messages.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns the number of type variables created thus far.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns the "root" variable of vid in the eq_relations equivalence table. All type variables that have been equated will yield the same root variable (per the union-find algorithm), so root_var(a) == root_var(b) implies that a == b (transitively).

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns the "root" variable of vid in the sub_relations equivalence table. All type variables that have been are related via equality or subtyping will yield the same root variable (per the union-find algorithm), so sub_root_var(a) == sub_root_var(b) implies that:

exists X. (a <: X || X <: a) && (b <: X || X <: b)

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

True if a and b have same "sub-root" (i.e., exists some type X such that forall i in {a, b}. (i <: X || X <: i).

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Retrieves the type to which vid has been instantiated, if any.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

If t is a type-inference variable, and it has been instantiated, then return the with which it was instantiated. Otherwise, returns t.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Creates a snapshot of the type variable state. This snapshot must later be committed (commit()) or rolled back (rollback_to()). Nested snapshots are permitted, but must be processed in a stack-like fashion.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Undoes all changes since the snapshot was created. Any snapshots created since that point must already have been committed or rolled back.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Commits all changes since the snapshot was created, making them permanent (unless this snapshot was created within another snapshot). Any snapshots created since that point must already have been committed or rolled back.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns a map {V1 -> V2}, where the keys {V1} are ty-variables created during the snapshot, and the values {V2} are the root variables that they were unified with, along with their origin.

Important traits for Vec<u8>

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Find the set of type variables that existed before s but which have only been unified since s started, and return the types with which they were unified. So if we had a type variable V0, then we started the snapshot, then we created a type variable V1, unifed V0 with T0, and unified V1 with T1, this function would return {T0}.

Important traits for Vec<u8>

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Returns indices of all variables that are not yet instantiated.

Auto Trait Implementations

impl<'tcx> !Send for TypeVariableTable<'tcx>

impl<'tcx> !Sync for TypeVariableTable<'tcx>

Blanket Implementations

impl<T> MaybeResult for T
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

impl<'a, T> Captures for T where
    T: ?Sized
[src]

impl<T> From for T
[src]

Performs the conversion.

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

Performs the conversion.

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Important traits for &'a mut R

Immutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Important traits for &'a mut R

Mutably borrows from an owned value. Read more

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<E> SpecializationError for E
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S is the encoder/decoder state type, T is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more

impl<T> Erased for T
[src]

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

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

impl<T> Erased for T