diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-07-22 16:48:36 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-09-14 19:02:44 +0200 |
| commit | eb19a8a6208d992d6d4e661be8fa80c1eeab01f6 (patch) | |
| tree | 61095efad35d8de4b0096fb90dfa234c7d19f192 /compiler/rustc_query_impl | |
| parent | c97922dca563cb7f9385b18dbf7ca8c97f8e1597 (diff) | |
| download | rust-eb19a8a6208d992d6d4e661be8fa80c1eeab01f6.tar.gz rust-eb19a8a6208d992d6d4e661be8fa80c1eeab01f6.zip | |
Compute `lint_levels` by definition
Diffstat (limited to 'compiler/rustc_query_impl')
| -rw-r--r-- | compiler/rustc_query_impl/src/keys.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index 49175e97f41..ea2d10cd14b 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -1,6 +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::HirId; use rustc_middle::infer::canonical::Canonical; use rustc_middle::mir; use rustc_middle::traits; @@ -543,3 +544,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()) + } +} |
