Trait rustc_middle::query::keys::Key

source ·
pub trait Key: Sized {
    type Cache<V>;

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

    // Provided methods
    fn key_as_def_id(&self) -> Option<DefId> { ... }
    fn ty_def_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§

source

type Cache<V>

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_def_id(&self) -> Option<DefId>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Key for (CrateNum, DefId)

source§

impl Key for (CrateNum, SimplifiedType)

source§

impl Key for (DefId, DefId)

source§

type Cache<V> = DefaultCache<(DefId, DefId), V>

source§

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

source§

impl Key for (DefId, LocalDefId)

source§

impl Key for (DefId, Ident)

source§

impl Key for (DefId, SimplifiedType)

source§

impl Key for (LocalDefId, HirId)

source§

impl Key for (LocalDefId, DefId)

source§

impl Key for (LocalDefId, LocalDefId)

source§

impl Key for (LocalDefId, LocalDefId, Ident)

source§

impl Key for (Symbol, u32, u32)

source§

type Cache<V> = DefaultCache<(Symbol, u32, u32), V>

source§

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

source§

impl Key for Option<Symbol>

source§

impl Key for ()

source§

type Cache<V> = SingleCache<V>

source§

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

source§

impl Key for HirId

source§

impl Key for OwnerId

source§

impl Key for CrateNum

source§

impl Key for DefId

source§

impl Key for LocalDefId

source§

impl Key for LocalModDefId

source§

impl Key for ModDefId

source§

impl Key for Symbol

source§

type Cache<V> = DefaultCache<Symbol, V>

source§

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

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(DefId, Ty<'tcx>, &'tcx RawList<(), GenericArg<'tcx>>, ParamEnv<'tcx>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(DefId, &'tcx RawList<(), GenericArg<'tcx>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(LocalDefId, DefId, &'tcx RawList<(), GenericArg<'tcx>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Instance<'tcx>, &'tcx RawList<(), Ty<'tcx>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Instance<'tcx>, LocalDefId), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Predicate<'tcx>, WellFormedLoc), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(ParamEnv<'tcx>, TraitRef<TyCtxt<'tcx>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Ty<'tcx>, ValTree<'tcx>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Ty<'tcx>, Option<Binder<TyCtxt<'tcx>, ExistentialTraitRef<TyCtxt<'tcx>>>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Ty<'tcx>, VariantIdx), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Ty<'tcx>, Ty<'tcx>), V>

source§

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

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>, Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>), V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<(Binder<TyCtxt<'tcx>, FnSig<TyCtxt<'tcx>>>, &'tcx RawList<(), Ty<'tcx>>), V>

source§

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

Implementors§

source§

impl Key for SimplifiedType

source§

impl<'tcx> Key for InstanceKind<'tcx>

source§

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

source§

type Cache<V> = DefaultCache<GlobalId<'tcx>, V>

source§

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

source§

impl<'tcx> Key for Const<'tcx>

source§

type Cache<V> = DefaultCache<Const<'tcx>, V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<Instance<'tcx>, V>

source§

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

source§

type Cache<V> = DefaultCache<ParamEnv<'tcx>, V>

source§

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

source§

type Cache<V> = DefaultCache<Ty<'tcx>, V>

source§

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

source§

type Cache<V> = DefaultCache<&'tcx RawList<(), GenericArg<'tcx>>, V>

source§

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

source§

type Cache<V> = DefaultCache<TyAndLayout<'tcx, Ty<'tcx>>, V>

source§

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

source§

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

source§

type Cache<V> = DefaultCache<Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>, V>

source§

impl<'tcx> Key for TraitRef<'tcx>

source§

impl<'tcx> Key for Clauses<'tcx>

source§

type Cache<V> = DefaultCache<&'tcx RawList<TypeInfo, Clause<'tcx>>, V>

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§

type Cache<V> = DefaultCache<Canonical<TyCtxt<'tcx>, T>, V>

source§

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

source§

type Cache<V> = DefaultCache<ParamEnvAnd<'tcx, T>, V>