From 2ef67c1b1a5de5f999baeabd01c3105dec763468 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Tue, 10 Dec 2024 15:41:38 +0100 Subject: [PATCH] feat(exporter): add a `kind` on `DefId`s Fixes #1163 --- frontend/exporter/src/types/def_id.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/exporter/src/types/def_id.rs b/frontend/exporter/src/types/def_id.rs index a777ceded..7d0e5deed 100644 --- a/frontend/exporter/src/types/def_id.rs +++ b/frontend/exporter/src/types/def_id.rs @@ -54,6 +54,10 @@ pub struct DefIdContents { /// indexes unless you cannot do otherwise. pub index: (u32, u32), pub is_local: bool, + + /// The kind of definition this `DefId` points to. + #[cfg(not(feature = "extract_names_mode"))] + pub kind: crate::DefKind, } #[cfg(feature = "rustc")] @@ -140,6 +144,8 @@ pub(crate) fn translate_def_id<'tcx, S: BaseState<'tcx>>(s: &S, def_id: RDefId) rustc_hir::def_id::DefIndex::as_u32(def_id.index), ), is_local: def_id.is_local(), + #[cfg(not(feature = "extract_names_mode"))] + kind: tcx.def_kind(def_id).sinto(s), }; let contents = s.with_global_cache(|cache| id_table::Node::new(contents, &mut cache.id_table_session));