Trait rustc_middle::query::Key

source ·
pub trait Key: Sized {
    type CacheSelector;

    // Required method
    fn default_span(&self, tcx: TyCtxt<'_>) -> Span;

    // Provided methods
    fn key_as_def_id(&self) -> Option<DefId> { ... }
    fn ty_adt_id(&self) -> Option<DefId> { ... }
}
Expand description

The Key trait controls what types can legally be used as the key for a query.

Required Associated Types§

Required Methods§

source

fn default_span(&self, tcx: TyCtxt<'_>) -> Span

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?

Provided Methods§

source

fn key_as_def_id(&self) -> Option<DefId>

If the key is a DefId or DefId–equivalent, return that DefId. Otherwise, return None.

source

fn ty_adt_id(&self) -> Option<DefId>

Implementations on Foreign Types§

source§

impl<'tcx> Key for (ValidityRequirement, ParamEnvAnd<'tcx, Ty<'tcx>>)

source§

impl Key for CrateNum

source§

impl Key for LocalDefId

source§

impl<'tcx> Key for (ParamEnv<'tcx>, TraitRef<'tcx>)

source§

impl<'tcx> Key for (PolyTraitRef<'tcx>, PolyTraitRef<'tcx>)

§

type CacheSelector = DefaultCacheSelector<(Binder<'tcx, TraitRef<'tcx>>, Binder<'tcx, TraitRef<'tcx>>)>

source§

fn default_span(&self, tcx: TyCtxt<'_>) -> Span

source§

impl Key for (DefId, Ident)

source§

impl Key for ModDefId

source§

impl<'tcx> Key for (UnevaluatedConst<'tcx>, UnevaluatedConst<'tcx>)

source§

impl Key for Symbol

source§

impl Key for (LocalDefId, DefId)

source§

impl<'tcx> Key for (Const<'tcx>, FieldIdx)

source§

impl Key for (Symbol, u32, u32)

source§

impl Key for HirId

source§

impl Key for (DefId, DefId)

source§

impl Key for OwnerId

source§

impl Key for LocalModDefId

source§

impl<'tcx> Key for (Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>)

source§

impl<'tcx> Key for (DefId, Ty<'tcx>, GenericArgsRef<'tcx>, ParamEnv<'tcx>)

§

type CacheSelector = DefaultCacheSelector<(DefId, Ty<'tcx>, &'tcx List<GenericArg<'tcx>>, ParamEnv<'tcx>)>

source§

fn default_span(&self, _tcx: TyCtxt<'_>) -> Span

source§

impl<'tcx> Key for (Ty<'tcx>, ValTree<'tcx>)

source§

impl Key for DefId

source§

impl<'tcx> Key for (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)

§

type CacheSelector = DefaultCacheSelector<(Binder<'tcx, FnSig<'tcx>>, &'tcx List<Ty<'tcx>>)>

source§

fn default_span(&self, _: TyCtxt<'_>) -> Span

source§

impl Key for (LocalDefId, LocalDefId, Ident)

source§

impl<'tcx> Key for (Instance<'tcx>, LocalDefId)

source§

impl Key for (CrateNum, SimplifiedType)

source§

impl Key for ()

source§

impl Key for (DefId, LocalDefId)

source§

impl Key for (CrateNum, DefId)

source§

impl<'tcx> Key for (LocalDefId, DefId, GenericArgsRef<'tcx>)

source§

impl Key for (LocalDefId, LocalDefId)

source§

impl<'tcx> Key for (Instance<'tcx>, &'tcx List<Ty<'tcx>>)

§

type CacheSelector = DefaultCacheSelector<(Instance<'tcx>, &'tcx List<Ty<'tcx>>)>

source§

fn default_span(&self, tcx: TyCtxt<'_>) -> Span

source§

impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>)

§

type CacheSelector = DefaultCacheSelector<(Ty<'tcx>, Ty<'tcx>)>

source§

fn default_span(&self, _: TyCtxt<'_>) -> Span

source§

impl<'tcx> Key for (DefId, GenericArgsRef<'tcx>)

source§

impl Key for (DefId, SimplifiedType)

source§

impl<'tcx> Key for (Predicate<'tcx>, WellFormedLoc)

source§

impl<'tcx> Key for (ConstValue<'tcx>, Ty<'tcx>)

source§

impl Key for Option<Symbol>

Implementors§

source§

impl Key for SimplifiedType

source§

impl<'tcx> Key for &'tcx List<Clause<'tcx>>

source§

impl<'tcx> Key for rustc_middle::mir::consts::Const<'tcx>

source§

impl<'tcx> Key for InstanceDef<'tcx>

source§

impl<'tcx> Key for ConstAlloc<'tcx>

source§

impl<'tcx> Key for GlobalId<'tcx>

source§

impl<'tcx> Key for LitToConstInput<'tcx>

source§

impl<'tcx> Key for rustc_middle::ty::consts::Const<'tcx>

source§

impl<'tcx> Key for GenericArg<'tcx>

source§

impl<'tcx> Key for Instance<'tcx>

source§

impl<'tcx> Key for ParamEnv<'tcx>

source§

impl<'tcx> Key for Ty<'tcx>

source§

impl<'tcx> Key for GenericArgsRef<'tcx>

source§

impl<'tcx> Key for TyAndLayout<'tcx>

source§

impl<'tcx> Key for PolyExistentialTraitRef<'tcx>

source§

impl<'tcx> Key for PolyTraitRef<'tcx>

source§

impl<'tcx, T: Clone> Key for Canonical<'tcx, T>

Canonical query goals correspond to abstract trait operations that are not tied to any crate in particular.

source§

impl<'tcx, T: Key> Key for ParamEnvAnd<'tcx, T>