Compute lint_levels by definition

This commit is contained in:
Deadbeef 2022-07-22 16:48:36 +00:00 committed by Camille GILLOT
parent c97922dca5
commit eb19a8a620
13 changed files with 482 additions and 332 deletions

View file

@ -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())
}
}