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

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

Variants

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

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]

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

Trait Implementations

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

fn clone(&self) -> MonoItem<'tcx>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher, 
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

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

fn hash_stable(
    &self,
    hcx: &mut StableHashingContext<'a>,
    hasher: &mut StableHasher
)
[src]

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

fn eq(&self, other: &MonoItem<'tcx>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &MonoItem<'tcx>) -> bool[src]

This method tests for !=.

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

impl<'tcx> Eq 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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn allocate_on(Self, &'a Arena<'tcx>) -> &'a mut T[src]

pub fn allocate_from_iter(
    &'a Arena<'tcx>,
    impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

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