[][src]Enum rustc::traits::Vtable

pub enum Vtable<'tcx, N> {
    VtableImpl(VtableImplData<'tcx, N>),
    VtableAutoImpl(VtableAutoImplData<N>),
    VtableParam(Vec<N>),
    VtableObject(VtableObjectData<'tcx, N>),
    VtableBuiltin(VtableBuiltinData<N>),
    VtableClosure(VtableClosureData<'tcx, N>),
    VtableFnPointer(VtableFnPointerData<'tcx, N>),
    VtableGenerator(VtableGeneratorData<'tcx, N>),
    VtableTraitAlias(VtableTraitAliasData<'tcx, N>),
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given the successful resolution of an obligation, the Vtable indicates where the vtable comes from. Note that while we call this a "vtable", it does not necessarily indicate dynamic dispatch at runtime. Vtable instances just tell the compiler where to find methods, but in generic code those methods are typically statically dispatched -- only when an object is constructed is a Vtable instance reified into an actual vtable.

For example, the vtable may be tied to a specific impl (case A), or it may be relative to some bound that is in scope (case B).

impl<T:Clone> Clone<T> for Option<T> { ... } // Impl_1
impl<T:Clone> Clone<T> for Box<T> { ... }    // Impl_2
impl Clone for int { ... }             // Impl_3

fn foo<T:Clone>(concrete: Option<Box<int>>,
                param: T,
                mixed: Option<T>) {

   // Case A: Vtable points at a specific impl. Only possible when
   // type is concretely known. If the impl itself has bounded
   // type parameters, Vtable will carry resolutions for those as well:
   concrete.clone(); // Vtable(Impl_1, [Vtable(Impl_2, [Vtable(Impl_3)])])

   // Case B: Vtable must be provided by caller. This applies when
   // type is a type parameter.
   param.clone();    // VtableParam

   // Case C: A mix of cases A and B.
   mixed.clone();    // Vtable(Impl_1, [VtableParam])
}

The type parameter N

See explanation on VtableImplData.

Variants

VtableImpl(VtableImplData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Vtable identifying a particular impl.

VtableAutoImpl(VtableAutoImplData<N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Vtable for auto trait implementations. This carries the information and nested obligations with regards to an auto implementation for a trait Trait. The nested obligations ensure the trait implementation holds for all the constituent types.

VtableParam(Vec<N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Successful resolution to an obligation provided by the caller for some type parameter. The Vec<N> represents the obligations incurred from normalizing the where-clause (if any).

VtableObject(VtableObjectData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Virtual calls through an object.

VtableBuiltin(VtableBuiltinData<N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Successful resolution for a builtin trait.

VtableClosure(VtableClosureData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Vtable automatically generated for a closure. The DefId is the ID of the closure expression. This is a VtableImpl in spirit, but the impl is generated by the compiler and does not appear in the source.

VtableFnPointer(VtableFnPointerData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Same as above, but for a function pointer type with the given signature.

VtableGenerator(VtableGeneratorData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Vtable automatically generated for a generator.

VtableTraitAlias(VtableTraitAliasData<'tcx, N>)
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Vtable for a trait alias.

Methods

impl<'tcx, N> Vtable<'tcx, N>[src]

pub fn nested_obligations(self) -> Vec<N>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn map<M, F>(self, f: F) -> Vtable<'tcx, M> where
    F: FnMut(N) -> M, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Implementations

impl<'tcx, N: Clone> Clone for Vtable<'tcx, N>[src]

impl<'tcx, N: Debug> Debug for Vtable<'tcx, N>[src]

impl<'tcx, N: Decodable> Decodable for Vtable<'tcx, N>[src]

impl<'tcx, N: Encodable> Encodable for Vtable<'tcx, N>[src]

impl<'tcx, N: Eq> Eq for Vtable<'tcx, N>[src]

impl<'tcx, '__ctx, N> HashStable<StableHashingContext<'__ctx>> for Vtable<'tcx, N> where
    N: HashStable<StableHashingContext<'__ctx>>, 
[src]

impl<'a, 'tcx> Lift<'tcx> for Vtable<'a, ()>[src]

type Lifted = Vtable<'tcx, ()>

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'tcx, N: PartialEq> PartialEq<Vtable<'tcx, N>> for Vtable<'tcx, N>[src]

impl<'tcx, N> StructuralEq for Vtable<'tcx, N>[src]

impl<'tcx, N> StructuralPartialEq for Vtable<'tcx, N>[src]

impl<'tcx, N> TypeFoldable<'tcx> for Vtable<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

Auto Trait Implementations

impl<'tcx, N> !RefUnwindSafe for Vtable<'tcx, N>

impl<'tcx, N> !Send for Vtable<'tcx, N>

impl<'tcx, N> !Sync for Vtable<'tcx, N>

impl<'tcx, N> Unpin for Vtable<'tcx, N> where
    N: Unpin

impl<'tcx, N> !UnwindSafe for Vtable<'tcx, N>

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<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Decodable for T where
    T: UseSpecializedDecodable
[src]

impl<T> Encodable for T where
    T: UseSpecializedEncodable + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T[src]

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

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

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

type Error = !

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<E> SpecializationError for E[src]

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]