get_vtable in rustc_codegen_ssa::meth - Rust
Description: Creates a dynamic vtable for the given type and vtable origin. This is used only for objects.

Skip to main content

## get_vtable

# Function get_vtable

Source

    pub(crate) fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>(
        cx: &Cx,
        ty: Ty<'tcx>,
        trait_ref: Option<ExistentialTraitRef<'tcx>>,
    ) -> Cx::Value

Expand description

Creates a dynamic vtable for the given type and vtable origin. This is used only for objects.

The vtables are cached instead of created on every call.

The `trait_ref` encodes the erased self type. Hence if we are making an object `Foo<dyn Trait>` from a value of type `Foo<T>`, then `trait_ref` would map `T: Trait`.