Trait rustc_mir::monomorphize::item::MonoItemExt [−][src]
pub trait MonoItemExt<'a, 'tcx>: Debug { fn as_mono_item(&self) -> &MonoItem<'tcx>; fn is_generic_fn(&self) -> bool { ... } fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName { ... } fn instantiation_mode(
&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>
) -> InstantiationMode { ... } fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> { ... } fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool { ... } fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String { ... } fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> { ... } }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Required Methods
fn as_mono_item(&self) -> &MonoItem<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Provided Methods
fn is_generic_fn(&self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn instantiation_mode(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> InstantiationMode
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Returns whether 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.
fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implementors
impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx>