[−][src]Enum rustc_middle::mir::mono::MonoItem

pub enum MonoItem<'tcx> {
    Fn(Instance<'tcx>),
    Static(DefId),
    GlobalAsm(HirId),
}

Variants

Fn(Instance<'tcx>)
Static(DefId)
GlobalAsm(HirId)

Implementations

impl<'tcx> MonoItem<'tcx>[src]

pub fn size_estimate(&self, tcx: TyCtxt<'tcx>) -> usize[src]

pub fn is_generic_fn(&self) -> bool[src]

pub fn symbol_name(&self, tcx: TyCtxt<'tcx>) -> SymbolName<'tcx>[src]

pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx>) -> InstantiationMode[src]

pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx>) -> Option<Linkage>[src]

pub fn is_instantiable(&self, tcx: TyCtxt<'tcx>) -> bool[src]

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>[src]

Trait Implementations

impl<'tcx> Clone for MonoItem<'tcx>[src]

impl<'tcx> Copy for MonoItem<'tcx>[src]

impl<'tcx> Debug for MonoItem<'tcx>[src]

impl<'tcx> Display for MonoItem<'tcx>[src]

impl<'tcx> Eq for MonoItem<'tcx>[src]

impl<'tcx> Hash for MonoItem<'tcx>[src]

impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx>[src]

impl<'tcx> PartialEq<MonoItem<'tcx>> for MonoItem<'tcx>[src]

impl<'tcx> StructuralEq for MonoItem<'tcx>[src]

impl<'tcx> StructuralPartialEq for MonoItem<'tcx>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]