From cebbba081e4609099df3921de8a1422b7ea52599 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 30 Jan 2021 17:47:51 +0100 Subject: Only store a LocalDefId in hir::Item. Items are guaranteed to be HIR owner. --- compiler/rustc_span/src/def_id.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/rustc_span') diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index b24ede9c53a..70e9526f626 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -227,6 +227,8 @@ pub struct LocalDefId { pub local_def_index: DefIndex, } +pub const CRATE_DEF_ID: LocalDefId = LocalDefId { local_def_index: CRATE_DEF_INDEX }; + impl Idx for LocalDefId { #[inline] fn new(idx: usize) -> Self { @@ -268,6 +270,8 @@ impl Decodable for LocalDefId { } } +rustc_data_structures::define_id_collections!(LocalDefIdMap, LocalDefIdSet, LocalDefId); + impl HashStable for DefId { fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { hcx.hash_def_id(*self, hasher) -- cgit 1.4.1-3-g733a5