summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_middle/src/query/keys.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/query/keys.rs')
-rw-r--r--compiler/rustc_middle/src/query/keys.rs297
1 files changed, 67 insertions, 230 deletions
diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs
index 78ee8a6a8..23b28ac5c 100644
--- a/compiler/rustc_middle/src/query/keys.rs
+++ b/compiler/rustc_middle/src/query/keys.rs
@@ -12,6 +12,11 @@ use rustc_hir::hir_id::{HirId, OwnerId};
use rustc_query_system::query::{DefaultCacheSelector, SingleCacheSelector, VecCacheSelector};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};
+use rustc_target::abi::FieldIdx;
+
+/// Placeholder for `CrateNum`'s "local" counterpart
+#[derive(Copy, Clone, Debug)]
+pub struct LocalCrate;
/// The `Key` trait controls what types can legally be used as the key
/// for a query.
@@ -21,15 +26,11 @@ pub trait Key: Sized {
//
// ...But r-a doesn't support them yet and using a default here causes r-a to not infer
// return types of queries which is very annoying. Thus, until r-a support associated
- // type defaults, plese restrain from using them here <3
+ // type defaults, please restrain from using them here <3
//
// r-a issue: <https://github.com/rust-lang/rust-analyzer/issues/13693>
type CacheSelector;
- /// Given an instance of this key, what crate is it referring to?
- /// This is used to find the provider.
- fn query_crate_is_local(&self) -> bool;
-
/// 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?
fn default_span(&self, tcx: TyCtxt<'_>) -> Span;
@@ -45,14 +46,17 @@ pub trait Key: Sized {
}
}
+pub trait AsLocalKey: Key {
+ type LocalKey;
+
+ /// Given an instance of this key, what crate is it referring to?
+ /// This is used to find the provider.
+ fn as_local_key(&self) -> Option<Self::LocalKey>;
+}
+
impl Key for () {
type CacheSelector = SingleCacheSelector;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -61,23 +65,22 @@ impl Key for () {
impl<'tcx> Key for ty::InstanceDef<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.def_id())
}
}
-impl<'tcx> Key for ty::Instance<'tcx> {
- type CacheSelector = DefaultCacheSelector<Self>;
+impl<'tcx> AsLocalKey for ty::InstanceDef<'tcx> {
+ type LocalKey = Self;
#[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
+ fn as_local_key(&self) -> Option<Self::LocalKey> {
+ self.def_id().is_local().then(|| *self)
}
+}
+
+impl<'tcx> Key for ty::Instance<'tcx> {
+ type CacheSelector = DefaultCacheSelector<Self>;
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.def_id())
@@ -87,11 +90,6 @@ impl<'tcx> Key for ty::Instance<'tcx> {
impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.instance.default_span(tcx)
}
@@ -100,11 +98,6 @@ impl<'tcx> Key for mir::interpret::GlobalId<'tcx> {
impl<'tcx> Key for (Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -113,11 +106,6 @@ impl<'tcx> Key for (Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>) {
impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -126,25 +114,27 @@ impl<'tcx> Key for mir::interpret::LitToConstInput<'tcx> {
impl Key for CrateNum {
type CacheSelector = VecCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- *self == LOCAL_CRATE
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
}
-impl Key for OwnerId {
- type CacheSelector = VecCacheSelector<Self>;
+impl AsLocalKey for CrateNum {
+ type LocalKey = LocalCrate;
#[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
+ fn as_local_key(&self) -> Option<Self::LocalKey> {
+ (*self == LOCAL_CRATE).then_some(LocalCrate)
}
+}
+
+impl Key for OwnerId {
+ type CacheSelector = VecCacheSelector<Self>;
+
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.to_def_id().default_span(tcx)
}
+
fn key_as_def_id(&self) -> Option<DefId> {
Some(self.to_def_id())
}
@@ -153,13 +143,10 @@ impl Key for OwnerId {
impl Key for LocalDefId {
type CacheSelector = VecCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.to_def_id().default_span(tcx)
}
+
fn key_as_def_id(&self) -> Option<DefId> {
Some(self.to_def_id())
}
@@ -168,26 +155,28 @@ impl Key for LocalDefId {
impl Key for DefId {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.krate == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(*self)
}
+
#[inline(always)]
fn key_as_def_id(&self) -> Option<DefId> {
Some(*self)
}
}
-impl Key for ty::WithOptConstParam<LocalDefId> {
- type CacheSelector = DefaultCacheSelector<Self>;
+impl AsLocalKey for DefId {
+ type LocalKey = LocalDefId;
#[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
+ fn as_local_key(&self) -> Option<Self::LocalKey> {
+ self.as_local()
}
+}
+
+impl Key for ty::WithOptConstParam<LocalDefId> {
+ type CacheSelector = DefaultCacheSelector<Self>;
+
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.did.default_span(tcx)
}
@@ -196,10 +185,6 @@ impl Key for ty::WithOptConstParam<LocalDefId> {
impl Key for SimplifiedType {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -208,10 +193,6 @@ impl Key for SimplifiedType {
impl Key for (DefId, DefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0.krate == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.1.default_span(tcx)
}
@@ -220,10 +201,6 @@ impl Key for (DefId, DefId) {
impl<'tcx> Key for (ty::Instance<'tcx>, LocalDefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -232,10 +209,6 @@ impl<'tcx> Key for (ty::Instance<'tcx>, LocalDefId) {
impl Key for (DefId, LocalDefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0.krate == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.1.default_span(tcx)
}
@@ -244,10 +217,6 @@ impl Key for (DefId, LocalDefId) {
impl Key for (LocalDefId, DefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -256,38 +225,27 @@ impl Key for (LocalDefId, DefId) {
impl Key for (LocalDefId, LocalDefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
}
-impl Key for (DefId, Option<Ident>) {
+impl Key for (DefId, Ident) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0.krate == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.0)
}
+
#[inline(always)]
fn key_as_def_id(&self) -> Option<DefId> {
Some(self.0)
}
}
-impl Key for (DefId, LocalDefId, Ident) {
+impl Key for (LocalDefId, LocalDefId, Ident) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0.krate == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.1.default_span(tcx)
}
@@ -296,34 +254,40 @@ impl Key for (DefId, LocalDefId, Ident) {
impl Key for (CrateNum, DefId) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0 == LOCAL_CRATE
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.1.default_span(tcx)
}
}
-impl Key for (CrateNum, SimplifiedType) {
- type CacheSelector = DefaultCacheSelector<Self>;
+impl AsLocalKey for (CrateNum, DefId) {
+ type LocalKey = DefId;
#[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0 == LOCAL_CRATE
+ fn as_local_key(&self) -> Option<Self::LocalKey> {
+ (self.0 == LOCAL_CRATE).then(|| self.1)
}
+}
+
+impl Key for (CrateNum, SimplifiedType) {
+ type CacheSelector = DefaultCacheSelector<Self>;
+
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
}
-impl Key for (DefId, SimplifiedType) {
- type CacheSelector = DefaultCacheSelector<Self>;
+impl AsLocalKey for (CrateNum, SimplifiedType) {
+ type LocalKey = SimplifiedType;
#[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- self.0.krate == LOCAL_CRATE
+ fn as_local_key(&self) -> Option<Self::LocalKey> {
+ (self.0 == LOCAL_CRATE).then(|| self.1)
}
+}
+
+impl Key for (DefId, SimplifiedType) {
+ type CacheSelector = DefaultCacheSelector<Self>;
+
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -332,10 +296,6 @@ impl Key for (DefId, SimplifiedType) {
impl<'tcx> Key for SubstsRef<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -344,10 +304,6 @@ impl<'tcx> Key for SubstsRef<'tcx> {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -356,10 +312,6 @@ impl<'tcx> Key for (DefId, SubstsRef<'tcx>) {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
(self.0).def.did.default_span(tcx)
}
@@ -368,10 +320,6 @@ impl<'tcx> Key for (ty::UnevaluatedConst<'tcx>, ty::UnevaluatedConst<'tcx>) {
impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -380,22 +328,14 @@ impl<'tcx> Key for (LocalDefId, DefId, SubstsRef<'tcx>) {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.1.def_id())
}
}
-impl<'tcx> Key for (ty::Const<'tcx>, mir::Field) {
+impl<'tcx> Key for (ty::Const<'tcx>, FieldIdx) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -404,10 +344,6 @@ impl<'tcx> Key for (ty::Const<'tcx>, mir::Field) {
impl<'tcx> Key for mir::interpret::ConstAlloc<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -416,10 +352,6 @@ impl<'tcx> Key for mir::interpret::ConstAlloc<'tcx> {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.def_id())
}
@@ -428,10 +360,6 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx> {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.def_id())
}
@@ -440,10 +368,6 @@ impl<'tcx> Key for ty::PolyExistentialTraitRef<'tcx> {
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
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.def_span(self.0.def_id())
}
@@ -452,10 +376,6 @@ impl<'tcx> Key for (ty::PolyTraitRef<'tcx>, ty::PolyTraitRef<'tcx>) {
impl<'tcx> Key for GenericArg<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -464,10 +384,6 @@ impl<'tcx> Key for GenericArg<'tcx> {
impl<'tcx> Key for mir::ConstantKind<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -476,10 +392,6 @@ impl<'tcx> Key for mir::ConstantKind<'tcx> {
impl<'tcx> Key for ty::Const<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -488,13 +400,10 @@ impl<'tcx> Key for ty::Const<'tcx> {
impl<'tcx> Key for Ty<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
+
fn ty_adt_id(&self) -> Option<DefId> {
match self.kind() {
ty::Adt(adt, _) => Some(adt.did()),
@@ -506,10 +415,6 @@ impl<'tcx> Key for Ty<'tcx> {
impl<'tcx> Key for TyAndLayout<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -518,10 +423,6 @@ impl<'tcx> Key for TyAndLayout<'tcx> {
impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -530,10 +431,6 @@ impl<'tcx> Key for (Ty<'tcx>, Ty<'tcx>) {
impl<'tcx> Key for &'tcx ty::List<ty::Predicate<'tcx>> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -542,10 +439,6 @@ impl<'tcx> Key for &'tcx ty::List<ty::Predicate<'tcx>> {
impl<'tcx> Key for ty::ParamEnv<'tcx> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -554,10 +447,6 @@ impl<'tcx> Key for ty::ParamEnv<'tcx> {
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()
- }
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.value.default_span(tcx)
}
@@ -566,10 +455,6 @@ impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> {
impl Key for Symbol {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -578,10 +463,6 @@ impl Key for Symbol {
impl Key for Option<Symbol> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -589,14 +470,9 @@ impl Key for Option<Symbol> {
/// 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> {
+impl<'tcx, T: Clone> Key for Canonical<'tcx, T> {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -605,11 +481,6 @@ impl<'tcx, T> Key for Canonical<'tcx, T> {
impl Key for (Symbol, u32, u32) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -618,11 +489,6 @@ impl Key for (Symbol, u32, u32) {
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
- }
-
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -631,11 +497,6 @@ impl<'tcx> Key for (DefId, Ty<'tcx>, SubstsRef<'tcx>, ty::ParamEnv<'tcx>) {
impl<'tcx> Key for (ty::Predicate<'tcx>, traits::WellFormedLoc) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _tcx: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -644,11 +505,6 @@ impl<'tcx> Key for (ty::Predicate<'tcx>, traits::WellFormedLoc) {
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
- }
-
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -657,11 +513,6 @@ impl<'tcx> Key for (ty::PolyFnSig<'tcx>, &'tcx ty::List<Ty<'tcx>>) {
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
- }
-
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
self.0.default_span(tcx)
}
@@ -670,11 +521,6 @@ impl<'tcx> Key for (ty::Instance<'tcx>, &'tcx ty::List<Ty<'tcx>>) {
impl<'tcx> Key for (Ty<'tcx>, ty::ValTree<'tcx>) {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP
}
@@ -683,11 +529,6 @@ impl<'tcx> Key for (Ty<'tcx>, ty::ValTree<'tcx>) {
impl Key for HirId {
type CacheSelector = DefaultCacheSelector<Self>;
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
-
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
tcx.hir().span(*self)
}
@@ -702,10 +543,6 @@ impl<'tcx> Key for (ValidityRequirement, ty::ParamEnvAnd<'tcx, Ty<'tcx>>) {
type CacheSelector = DefaultCacheSelector<Self>;
// Just forward to `Ty<'tcx>`
- #[inline(always)]
- fn query_crate_is_local(&self) -> bool {
- true
- }
fn default_span(&self, _: TyCtxt<'_>) -> Span {
DUMMY_SP