summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-01-30 17:47:51 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-02-15 19:32:10 +0100
commitcebbba081e4609099df3921de8a1422b7ea52599 (patch)
tree96784e4ada9c7d62e8890ce8bac2d4f840eba6c4 /compiler/rustc_span/src
parentbd3cd5dbed5f56fb44a14a20dd2113e3049d2565 (diff)
downloadrust-cebbba081e4609099df3921de8a1422b7ea52599.tar.gz
rust-cebbba081e4609099df3921de8a1422b7ea52599.zip
Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/def_id.rs4
1 files changed, 4 insertions, 0 deletions
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<D: Decoder> Decodable<D> for LocalDefId {
     }
 }
 
+rustc_data_structures::define_id_collections!(LocalDefIdMap, LocalDefIdSet, LocalDefId);
+
 impl<CTX: HashStableContext> HashStable<CTX> for DefId {
     fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
         hcx.hash_def_id(*self, hasher)