Function rustc_codegen_ssa::meth::get_vtable
source · pub fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>(
cx: &Cx,
ty: Ty<'tcx>,
trait_ref: Option<PolyExistentialTraitRef<'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
.