diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-07-22 16:48:36 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-01 16:12:50 +0200 |
| commit | 3cb1811e459d1cf30dcb553ab99ce090cd5c76f1 (patch) | |
| tree | ba405b86869d065cae3b192f5197f452bf38c1ca /compiler/rustc_query_impl/src | |
| parent | 6019cbbfd3121d294c4705528ee66642e31ccf79 (diff) | |
| download | rust-3cb1811e459d1cf30dcb553ab99ce090cd5c76f1.tar.gz rust-3cb1811e459d1cf30dcb553ab99ce090cd5c76f1.zip | |
Compute `lint_levels` by definition
Diffstat (limited to 'compiler/rustc_query_impl/src')
| -rw-r--r-- | compiler/rustc_query_impl/src/keys.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index 47762440e29..b6cf79b828b 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -1,7 +1,7 @@ //! Defines the set of legal keys that can be used in queries. use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; -use rustc_hir::hir_id::OwnerId; +use rustc_hir::hir_id::{HirId, OwnerId}; use rustc_middle::infer::canonical::Canonical; use rustc_middle::mir; use rustc_middle::traits; @@ -557,3 +557,19 @@ impl<'tcx> Key for (Ty<'tcx>, ty::ValTree<'tcx>) { DUMMY_SP } } + +impl Key for HirId { + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true + } + + fn default_span(&self, tcx: TyCtxt<'_>) -> Span { + self.owner.default_span(tcx) + } + + #[inline(always)] + fn key_as_def_id(&self) -> Option<DefId> { + Some(self.owner.to_def_id()) + } +} |
