Help rust-analyzer normalize query return types
This commit is contained in:
parent
c5351ad4dc
commit
7e79c575e9
@ -15,7 +15,7 @@
|
||||
/// The `Key` trait controls what types can legally be used as the key
|
||||
/// for a query.
|
||||
pub trait Key: Sized {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
type CacheSelector;
|
||||
|
||||
/// Given an instance of this key, what crate is it referring to?
|
||||
/// This is used to find the provider.
|
||||
@ -37,6 +37,8 @@ fn ty_adt_id(&self) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl Key for () {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -48,6 +50,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::InstanceDef<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -59,6 +63,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::Instance<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -70,6 +76,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -81,6 +89,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -92,6 +102,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -145,6 +157,8 @@ fn key_as_def_id(&self) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl Key for DefId {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.krate == LOCAL_CRATE
|
||||
@ -159,6 +173,8 @@ fn key_as_def_id(&self) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl Key for ty::WithOptConstParam<LocalDefId> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -169,6 +185,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for SimplifiedType {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -179,6 +197,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (DefId, DefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -189,6 +209,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::Instance<'tcx>, LocalDefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -199,6 +221,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (DefId, LocalDefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -209,6 +233,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (LocalDefId, DefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -219,6 +245,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (LocalDefId, LocalDefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -229,6 +257,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (DefId, Option<Ident>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -243,6 +273,8 @@ fn key_as_def_id(&self) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl Key for (DefId, LocalDefId, Ident) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -253,6 +285,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (CrateNum, DefId) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0 == LOCAL_CRATE
|
||||
@ -263,6 +297,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (CrateNum, SimplifiedType) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0 == LOCAL_CRATE
|
||||
@ -273,6 +309,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (DefId, SimplifiedType) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -283,6 +321,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for SubstsRef<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -293,6 +333,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (DefId, SubstsRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.krate == LOCAL_CRATE
|
||||
@ -303,6 +345,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::UnevaluatedConst<'tcx>, ty::UnevaluatedConst<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
(self.0).def.did.krate == LOCAL_CRATE
|
||||
@ -313,6 +357,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -323,6 +369,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.1.def_id().krate == LOCAL_CRATE
|
||||
@ -333,6 +381,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::Const<'tcx>, mir::Field) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -343,6 +393,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for mir::interpret::ConstAlloc<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -353,6 +405,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::PolyTraitRef<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.def_id().krate == LOCAL_CRATE
|
||||
@ -363,6 +417,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::PolyExistentialTraitRef<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.def_id().krate == LOCAL_CRATE
|
||||
@ -373,6 +429,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::PolyTraitRef<'tcx>, ty::PolyTraitRef<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.0.def_id().krate == LOCAL_CRATE
|
||||
@ -383,6 +441,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for GenericArg<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -393,6 +453,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for mir::ConstantKind<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -403,6 +465,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::Const<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -413,6 +477,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for Ty<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -429,6 +495,8 @@ fn ty_adt_id(&self) -> Option<DefId> {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for TyAndLayout<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -439,6 +507,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -449,6 +519,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for &'tcx ty::List<ty::Predicate<'tcx>> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -459,6 +531,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for ty::ParamEnv<'tcx> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -469,6 +543,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
self.value.query_crate_is_local()
|
||||
@ -479,6 +555,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for Symbol {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -489,6 +567,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for Option<Symbol> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -501,6 +581,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
/// Canonical query goals correspond to abstract trait operations that
|
||||
/// are not tied to any crate in particular.
|
||||
impl<'tcx, T> Key for Canonical<'tcx, T> {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -512,6 +594,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for (Symbol, u32, u32) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -523,6 +607,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ty::ParamEnv<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -534,6 +620,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::Predicate<'tcx>, traits::WellFormedLoc) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -545,6 +633,8 @@ fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -556,6 +646,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -567,6 +659,8 @@ fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl<'tcx> Key for (Ty<'tcx>, ty::ValTree<'tcx>) {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
@ -578,6 +672,8 @@ fn default_span(&self, _: TyCtxt<'_>) -> Span {
|
||||
}
|
||||
|
||||
impl Key for HirId {
|
||||
type CacheSelector = DefaultCacheSelector<Self>;
|
||||
|
||||
#[inline(always)]
|
||||
fn query_crate_is_local(&self) -> bool {
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user