Struct rustc::ty::Instance
[−]
[src]
pub struct Instance<'tcx> {
pub def: InstanceDef<'tcx>,
pub substs: &'tcx Substs<'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?
Fields
def: InstanceDef<'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?
substs: &'tcx Substs<'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?
Methods
impl<'a, 'b, 'tcx> Instance<'tcx>[src]
pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> Instance<'tcx>[src]
🔬 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?
pub fn mono(tcx: TyCtxt<'a, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx>[src]
🔬 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?
pub fn def_id(&self) -> DefId[src]
🔬 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?
pub fn resolve(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: ParamEnv<'tcx>,
def_id: DefId,
substs: &'tcx Substs<'tcx>
) -> Option<Instance<'tcx>>[src]
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: ParamEnv<'tcx>,
def_id: DefId,
substs: &'tcx Substs<'tcx>
) -> Option<Instance<'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?
Resolve a (def_id, substs) pair to an (optional) instance -- most commonly, this is used to find the precise code that will run for a trait method invocation, if known.
Returns None if we cannot resolve Instance to a specific instance.
For example, in a context like this,
fn foo<T: Debug>(t: T) { ... }
trying to resolve Debug::fmt applied to T will yield None, because we do not
know what code ought to run. (Note that this setting is also affected by the
RevealMode in the parameter environment.)
Presuming that coherence and type-check have succeeded, if this method is invoked
in a monomorphic context (i.e., like during trans), then it is guaranteed to return
Some.
pub fn resolve_closure(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
substs: ClosureSubsts<'tcx>,
requested_kind: ClosureKind
) -> Instance<'tcx>[src]
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
substs: ClosureSubsts<'tcx>,
requested_kind: ClosureKind
) -> Instance<'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?
Trait Implementations
impl<'tcx> HashStable<StableHashingContext<'tcx>> for Instance<'tcx>[src]
fn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'tcx>,
__hasher: &mut StableHasher<W>
)[src]
&self,
__ctx: &mut StableHashingContext<'tcx>,
__hasher: &mut StableHasher<W>
)
🔬 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?
impl<'tcx> Key for Instance<'tcx>[src]
fn map_crate(&self) -> CrateNum[src]
🔬 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?
Given an instance of this key, what crate is it referring to? This is used to find the provider. Read more
fn default_span(&self, tcx: TyCtxt) -> Span[src]
🔬 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?
In the event that a cycle occurs, if no explicit span has been given for a query with key self, what span should we use? Read more
impl<'tcx> Copy for Instance<'tcx>[src]
impl<'tcx> Clone for Instance<'tcx>[src]
fn clone(&self) -> Instance<'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> PartialEq for Instance<'tcx>[src]
fn eq(&self, __arg_0: &Instance<'tcx>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Instance<'tcx>) -> bool[src]
This method tests for !=.
impl<'tcx> Eq for Instance<'tcx>[src]
impl<'tcx> Hash for Instance<'tcx>[src]
fn hash<__H: Hasher>(&self, __arg_0: &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]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl<'tcx> Debug for Instance<'tcx>[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more