Trait rustc_middle::query::keys::Key
source · pub trait Key: Sized {
type CacheSelector = DefaultCacheSelector<Self>;
fn query_crate_is_local(&self) -> bool;
fn default_span(&self, tcx: TyCtxt<'_>) -> Span;
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.
Provided Associated Types§
type CacheSelector = DefaultCacheSelector<Self>
Required Methods§
sourcefn query_crate_is_local(&self) -> bool
fn query_crate_is_local(&self) -> bool
Given an instance of this key, what crate is it referring to? This is used to find the provider.
sourcefn default_span(&self, tcx: TyCtxt<'_>) -> Span
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§
sourcefn key_as_def_id(&self) -> Option<DefId>
fn key_as_def_id(&self) -> Option<DefId>
If the key is a DefId
or DefId
–equivalent, return that DefId
.
Otherwise, return None
.
fn ty_adt_id(&self) -> Option<DefId>
Implementations on Foreign Types§
source§impl Key for ()
impl Key for ()
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>)
impl<'tcx> Key for (Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl Key for CrateNum
impl Key for CrateNum
type CacheSelector = VecCacheSelector<CrateNum>
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl Key for OwnerId
impl Key for OwnerId
type CacheSelector = VecCacheSelector<OwnerId>
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn key_as_def_id(&self) -> Option<DefId>
source§impl Key for LocalDefId
impl Key for LocalDefId
type CacheSelector = VecCacheSelector<LocalDefId>
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn key_as_def_id(&self) -> Option<DefId>
source§impl Key for DefId
impl Key for DefId
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn key_as_def_id(&self) -> Option<DefId>
source§impl Key for (DefId, DefId)
impl Key for (DefId, DefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Instance<'tcx>, LocalDefId)
impl<'tcx> Key for (Instance<'tcx>, LocalDefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (DefId, LocalDefId)
impl Key for (DefId, LocalDefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (LocalDefId, DefId)
impl Key for (LocalDefId, DefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (LocalDefId, LocalDefId)
impl Key for (LocalDefId, LocalDefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (DefId, Option<Ident>)
impl Key for (DefId, Option<Ident>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn key_as_def_id(&self) -> Option<DefId>
source§impl Key for (DefId, LocalDefId, Ident)
impl Key for (DefId, LocalDefId, Ident)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (CrateNum, DefId)
impl Key for (CrateNum, DefId)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl Key for (CrateNum, SimplifiedType)
impl Key for (CrateNum, SimplifiedType)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl Key for (DefId, SimplifiedType)
impl Key for (DefId, SimplifiedType)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (DefId, SubstsRef<'tcx>)
impl<'tcx> Key for (DefId, SubstsRef<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (UnevaluatedConst<'tcx>, UnevaluatedConst<'tcx>)
impl<'tcx> Key for (UnevaluatedConst<'tcx>, UnevaluatedConst<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>)
impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (ParamEnv<'tcx>, PolyTraitRef<'tcx>)
impl<'tcx> Key for (ParamEnv<'tcx>, PolyTraitRef<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Const<'tcx>, Field)
impl<'tcx> Key for (Const<'tcx>, Field)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (PolyTraitRef<'tcx>, PolyTraitRef<'tcx>)
impl<'tcx> Key for (PolyTraitRef<'tcx>, PolyTraitRef<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>)
impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl Key for Symbol
impl Key for Symbol
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span
source§impl Key for Option<Symbol>
impl Key for Option<Symbol>
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span
source§impl Key for (Symbol, u32, u32)
impl Key for (Symbol, u32, u32)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ParamEnv<'tcx>)
impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ParamEnv<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Predicate<'tcx>, WellFormedLoc)
impl<'tcx> Key for (Predicate<'tcx>, WellFormedLoc)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)
impl<'tcx> Key for (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Instance<'tcx>, &'tcx List<Ty<'tcx>>)
impl<'tcx> Key for (Instance<'tcx>, &'tcx List<Ty<'tcx>>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
source§impl<'tcx> Key for (Ty<'tcx>, ValTree<'tcx>)
impl<'tcx> Key for (Ty<'tcx>, ValTree<'tcx>)
fn query_crate_is_local(&self) -> bool
fn default_span(&self, _: TyCtxt<'_>) -> Span
source§impl Key for HirId
impl Key for HirId
fn query_crate_is_local(&self) -> bool
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn key_as_def_id(&self) -> Option<DefId>
Implementors§
impl Key for SimplifiedType
impl Key for WithOptConstParam<LocalDefId>
impl<'tcx> Key for &'tcx List<Predicate<'tcx>>
impl<'tcx> Key for ConstantKind<'tcx>
impl<'tcx> Key for InstanceDef<'tcx>
impl<'tcx> Key for GlobalId<'tcx>
impl<'tcx> Key for LitToConstInput<'tcx>
impl<'tcx> Key for ConstAlloc<'tcx>
impl<'tcx> Key for Const<'tcx>
impl<'tcx> Key for Instance<'tcx>
impl<'tcx> Key for ParamEnv<'tcx>
impl<'tcx> Key for Ty<'tcx>
impl<'tcx> Key for GenericArg<'tcx>
impl<'tcx> Key for TyAndLayout<'tcx>
impl<'tcx> Key for PolyExistentialTraitRef<'tcx>
impl<'tcx> Key for PolyTraitRef<'tcx>
impl<'tcx> Key for SubstsRef<'tcx>
impl<'tcx, T> Key for Canonical<'tcx, T>
Canonical query goals correspond to abstract trait operations that are not tied to any crate in particular.