Variants
Fn(Instance<'tcx>)
Static(DefId)
GlobalAsm(ItemId)
Implementations
sourceimpl<'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
sourceimpl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx>
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx>
fn hash_stable(
&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher
)
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
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for T where
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
pub default fn fingerprint_style() -> FingerprintStyle
sourcepub default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
pub default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
pub default fn to_debug_str(&self, Ctxt) -> String
sourcepub default fn recover(
Ctxt,
&DepNode<<Ctxt as DepContext>::DepKind>
) -> Option<T>
pub default fn recover(
Ctxt,
&DepNode<<Ctxt as DepContext>::DepKind>
) -> Option<T>
This method tries to recover the query key from the given DepNode,
something which is needed when forcing DepNodes 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 more
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized,
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: 40 bytes
Size for each variant:
Fn: 36 bytesStatic: 8 bytesGlobalAsm: 4 bytes