[−][src]Struct rustc::infer::type_variable::TypeVariableTable
🔬 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
values: SnapshotVec<Delegate>
🔬 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?
eq_relations: UnificationTable<InPlace<TyVidEqKey<'tcx>>>
🔬 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.
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?
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]
impl<'tcx> TypeVariableTable<'tcx>pub fn new() -> TypeVariableTable<'tcx>[src]
pub fn new() -> TypeVariableTable<'tcx>🔬 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?
pub fn var_diverges<'a>(&'a self, vid: TyVid) -> bool[src]
pub fn var_diverges<'a>(&'a self, vid: TyVid) -> bool🔬 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.
pub fn var_origin(&self, vid: TyVid) -> &TypeVariableOrigin[src]
pub fn var_origin(&self, vid: TyVid) -> &TypeVariableOrigin🔬 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.
pub fn equate(&mut self, a: TyVid, b: TyVid)[src]
pub fn equate(&mut self, a: TyVid, b: 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?
Records that a == b, depending on dir.
Precondition: neither a nor b are known.
pub fn sub(&mut self, a: TyVid, b: TyVid)[src]
pub fn sub(&mut self, a: TyVid, b: 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?
Records that a <: b, depending on dir.
Precondition: neither a nor b are known.
pub fn instantiate(&mut self, vid: TyVid, ty: Ty<'tcx>)[src]
pub fn instantiate(&mut self, vid: TyVid, ty: Ty<'tcx>)🔬 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.
pub fn new_var(
&mut self,
universe: UniverseIndex,
diverging: bool,
origin: TypeVariableOrigin
) -> TyVid[src]
pub fn new_var(
&mut self,
universe: UniverseIndex,
diverging: bool,
origin: TypeVariableOrigin
) -> 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?
Creates a new type variable.
diverging: indicates if this is a "diverging" type variable, e.g. one created as the type of areturnexpression. 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.
pub fn num_vars(&self) -> usize[src]
pub fn num_vars(&self) -> usize🔬 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.
pub fn root_var(&mut self, vid: TyVid) -> TyVid[src]
pub fn root_var(&mut self, vid: TyVid) -> 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?
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).
pub fn sub_root_var(&mut self, vid: TyVid) -> TyVid[src]
pub fn sub_root_var(&mut self, vid: TyVid) -> 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?
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)
pub fn sub_unified(&mut self, a: TyVid, b: TyVid) -> bool[src]
pub fn sub_unified(&mut self, a: TyVid, b: TyVid) -> bool🔬 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).
pub fn probe(&mut self, vid: TyVid) -> TypeVariableValue<'tcx>[src]
pub fn probe(&mut self, vid: TyVid) -> TypeVariableValue<'tcx>🔬 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.
pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx>[src]
pub fn replace_if_possible(&mut self, t: Ty<'tcx>) -> Ty<'tcx>🔬 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.
pub fn snapshot(&mut self) -> Snapshot<'tcx>[src]
pub fn snapshot(&mut self) -> Snapshot<'tcx>🔬 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.
pub fn rollback_to(&mut self, s: Snapshot<'tcx>)[src]
pub fn rollback_to(&mut self, s: Snapshot<'tcx>)🔬 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.
pub fn commit(&mut self, s: Snapshot<'tcx>)[src]
pub fn commit(&mut self, s: Snapshot<'tcx>)🔬 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.
pub fn types_created_since_snapshot(
&mut self,
s: &Snapshot<'tcx>
) -> TypeVariableMap[src]
pub fn types_created_since_snapshot(
&mut self,
s: &Snapshot<'tcx>
) -> TypeVariableMap🔬 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.
pub fn types_escaping_snapshot(&mut self, s: &Snapshot<'tcx>) -> Vec<Ty<'tcx>>[src]
pub fn types_escaping_snapshot(&mut self, s: &Snapshot<'tcx>) -> Vec<Ty<'tcx>>🔬 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}.
pub fn unsolved_variables(&mut self) -> Vec<TyVid>[src]
pub fn unsolved_variables(&mut self) -> Vec<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?
Returns indices of all variables that are not yet instantiated.
Auto Trait Implementations
impl<'tcx> !Send for TypeVariableTable<'tcx>
impl<'tcx> !Send for TypeVariableTable<'tcx>impl<'tcx> !Sync for TypeVariableTable<'tcx>
impl<'tcx> !Sync for TypeVariableTable<'tcx>Blanket Implementations
impl<T> MaybeResult for T[src]
impl<T> MaybeResult for Tfn from_ok(T) -> T[src]
fn from_ok(T) -> 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?
fn map_same<F>(Self, F) -> T where
F: FnOnce(T) -> T, [src]
fn map_same<F>(Self, F) -> T where
F: FnOnce(T) -> 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?
impl<'a, T> Captures for T where
T: ?Sized, [src]
impl<'a, T> Captures for T where
T: ?Sized, impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T[src]
fn borrow(&self) -> &TImmutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 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]
impl<E> SpecializationError for Efn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized, [src]
fn not_found<S, T>(trait_name: &'static str, method_name: &'static str) -> E where
T: ?Sized, 🔬 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> Erased for Timpl<T> Send for T where
T: ?Sized, [src]
impl<T> Send for T where
T: ?Sized, impl<T> Sync for T where
T: ?Sized, [src]
impl<T> Sync for T where
T: ?Sized, impl<T> Erased for T
impl<T> Erased for T