Trait rustc::traits::query::type_op::QueryTypeOp[][src]

pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: Debug + Sized + TypeFoldable<'tcx> + Lift<'gcx> {
    type QueryResult: TypeFoldable<'tcx> + Lift<'gcx>;
    fn try_fast_path(
        tcx: TyCtxt<'_, 'gcx, 'tcx>,
        key: &ParamEnvAnd<'tcx, Self>
    ) -> Option<Self::QueryResult>;
fn perform_query(
        tcx: TyCtxt<'_, 'gcx, 'tcx>,
        canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>
    ) -> Fallible<CanonicalizedQueryResult<'gcx, Self::QueryResult>>;
fn shrink_to_tcx_lifetime<'a>(
        lifted_query_result: &'a CanonicalizedQueryResult<'gcx, Self::QueryResult>
    ) -> &'a Canonical<'tcx, QueryResult<'tcx, Self::QueryResult>>; fn fully_perform_into(
        query_key: ParamEnvAnd<'tcx, Self>,
        infcx: &InferCtxt<'_, 'gcx, 'tcx>,
        output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>
    ) -> Fallible<Self::QueryResult> { ... } }
🔬 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?

"Query type ops" are type ops that are implemented using a canonical query. The Self type here contains the kernel of information needed to do the operation -- TypeOp is actually implemented for ParamEnvAnd<Self>, since we always need to bring along a parameter environment as well. For query type-ops, we will first canonicalize the key and then invoke the query on the tcx, which produces the resulting query region constraints.

Associated Types

🔬 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

🔬 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?

Give query the option for a simple fast path that never actually hits the tcx cache lookup etc. Return Some(r) with a final result or None to do the full path.

🔬 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?

Performs the actual query with the canonicalized key -- the real work happens here. This method is not given an infcx because it shouldn't need one -- and if it had access to one, it might do things like invoke sub_regions, which would be bad, because it would create subregion relationships that are not captured in the return value.

🔬 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?

Casts a lifted query result (which is in the gcx lifetime) into the tcx lifetime. This is always just an identity cast, but the generic code doesn't realize it -- put another way, in the generic code, we have a Lifted<'gcx, Self::QueryResult> and we want to convert that to a Self::QueryResult. This is not a priori valid, so we can't do it -- but in practice, it is always a no-op (e.g., the lifted form of a type, Ty<'gcx>, is a subtype of Ty<'tcx>). So we have to push the operation into the impls that know more specifically what QueryResult is. This operation would (maybe) be nicer with something like HKTs or GATs, since then we could make QueryResult parametric and 'gcx and 'tcx etc.

Provided Methods

🔬 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