Enum rustc_middle::mir::mono::MonoItem
source · Variants§
Implementations§
source§impl<'tcx> MonoItem<'tcx>
impl<'tcx> MonoItem<'tcx>
sourcepub fn is_user_defined(&self) -> bool
pub fn is_user_defined(&self) -> bool
Returns true
if the mono item is user-defined (i.e. not compiler-generated, like shims).
pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize
pub fn is_generic_fn(&self) -> bool
pub fn symbol_name(&self, tcx: TyCtxt<'tcx>) -> SymbolName<'tcx>
pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode
pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx>) -> Option<Linkage>
sourcepub fn is_instantiable(&self, tcx: TyCtxt<'tcx>) -> bool
pub fn is_instantiable(&self, tcx: TyCtxt<'tcx>) -> bool
Returns true
if this instance is instantiable - whether it has no unsatisfied
predicates.
In order to codegen an item, all of its predicates must hold, because otherwise the item does not make sense. Type-checking ensures that the predicates of every item that is used by a valid item do hold, so we can rely on that.
However, we codegen collector roots (reachable items) and functions in vtables when they are seen, even if they are not used, and so they might not be instantiable. For example, a programmer can define this public function:
pub fn foo<'a>(s: &'a mut ()) where &'a mut (): Clone {
<&mut () as Clone>::clone(&s);
}
That function can’t be codegened, because the method <&mut () as Clone>::clone
does not exist. Luckily for us, that function can’t ever be used,
because that would require for &'a mut (): Clone
to hold, so we
can just not emit any code, or even a linker reference for it.
Similarly, if a vtable method has such a signature, and therefore can’t be used, we can just not emit it and have a placeholder (a null pointer, which will never be accessed) in its place.
pub fn local_span(&self, tcx: TyCtxt<'tcx>) -> Option<Span>
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx>) -> DepNode
Trait Implementations§
source§impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for MonoItem<'tcx>
impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for MonoItem<'tcx>
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
source§impl<'tcx> PartialEq<MonoItem<'tcx>> for MonoItem<'tcx>
impl<'tcx> PartialEq<MonoItem<'tcx>> for MonoItem<'tcx>
impl<'tcx> Copy for MonoItem<'tcx>
impl<'tcx> Eq for MonoItem<'tcx>
impl<'tcx> StructuralEq for MonoItem<'tcx>
impl<'tcx> StructuralPartialEq for MonoItem<'tcx>
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for MonoItem<'tcx>
impl<'tcx> !Send for MonoItem<'tcx>
impl<'tcx> !Sync for MonoItem<'tcx>
impl<'tcx> Unpin for MonoItem<'tcx>
impl<'tcx> !UnwindSafe for MonoItem<'tcx>
Blanket Implementations§
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T] ⓘ
source§impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
source§default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_debug_str(&self, _: Tcx) -> String
source§default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. Read moresource§impl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo]) -> T
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: 32 bytes
Size for each variant:
Fn
: 32 bytesStatic
: 8 bytesGlobalAsm
: 4 bytes