rustc: Make def_kind
mandatory for all DefId
s
This commit is contained in:
parent
fad6bb80fa
commit
2c23386344
13 changed files with 36 additions and 56 deletions
|
@ -1151,7 +1151,7 @@ rustc_queries! {
|
|||
cache_on_disk_if { true }
|
||||
}
|
||||
|
||||
query opt_def_kind(def_id: DefId) -> Option<DefKind> {
|
||||
query def_kind(def_id: DefId) -> DefKind {
|
||||
desc { |tcx| "looking up definition kind of `{}`", tcx.def_path_str(def_id) }
|
||||
cache_on_disk_if { def_id.is_local() }
|
||||
separate_provide_extern
|
||||
|
|
|
@ -12,7 +12,6 @@ use measureme::StringId;
|
|||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::AtomicU64;
|
||||
use rustc_data_structures::sync::WorkerLocal;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::hir_id::OwnerId;
|
||||
use rustc_query_system::dep_graph::DepNodeIndex;
|
||||
|
@ -668,21 +667,5 @@ mod sealed {
|
|||
|
||||
pub use sealed::IntoQueryParam;
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
|
||||
let def_id = def_id.into_query_param();
|
||||
self.opt_def_kind(def_id)
|
||||
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxtAt<'tcx> {
|
||||
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
|
||||
let def_id = def_id.into_query_param();
|
||||
self.opt_def_kind(def_id)
|
||||
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable)]
|
||||
pub struct CyclePlaceholder(pub ErrorGuaranteed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue