pub type LocalKey<'tcx> = Key<'tcx>;Expand description
Key type used by provider functions in local_providers.
Aliased Type§
pub enum LocalKey<'tcx> {
Item(DefId),
Intrinsic(DefId),
Virtual(DefId, usize),
Shim(ShimKind<'tcx>),
}Variants§
Item(DefId)
A user-defined callable item.
This includes:
fnitems- closures
- coroutines
Intrinsic(DefId)
An intrinsic fn item (with#[rustc_intrinsic]).
Alongside Virtual, this is the only InstanceKind that does not have its own callable MIR.
Instead, codegen and const eval “magically” evaluate calls to intrinsics purely in the
caller.
Virtual(DefId, usize)
Dynamic dispatch to <dyn Trait as Trait>::fn.
This InstanceKind may have a callable MIR as the default implementation.
Calls to Virtual instances must be codegen’d as virtual calls through the vtable.
This means we might not know exactly what is being called.
If this is reified to a fn pointer, a ReifyShim is used (see ReifyShim above for more
details on that).
Shim(ShimKind<'tcx>)
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes
Size for each variant:
Item: 12 bytesIntrinsic: 12 bytesVirtual: 24 bytesShim: 24 bytes