about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2021-08-18 18:29:11 +0200
committerMichael Woerister <michaelwoerister@posteo>2021-09-14 13:56:33 +0200
commit5f73085f925cd008fc28eed302f8bc026e7fb71c (patch)
tree41bc1d875f12dae96475b2502407487713229e92
parent021c0520e3ec4ddecac425f99db5749942785e65 (diff)
downloadrust-5f73085f925cd008fc28eed302f8bc026e7fb71c.tar.gz
rust-5f73085f925cd008fc28eed302f8bc026e7fb71c.zip
Rename DefPathHashMap in rustc_metadata so its name does not clash with DefPathHashMap in rustc_hir.
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs4
-rw-r--r--compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs26
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs6
-rw-r--r--compiler/rustc_metadata/src/rmeta/mod.rs4
4 files changed, 19 insertions, 21 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 51a8dcc9db4..8bb36103cd0 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -55,7 +55,7 @@ mod cstore_impl;
 crate struct MetadataBlob(Lrc<MetadataRef>);
 
 // This is needed so we can create an OwningRef into the blob.
-// The data behind a `MetadataBlob` has a stable address because it
+// The data behind a `MetadataBlob` has a stable address because it is
 // contained within an Rc/Arc.
 unsafe impl rustc_data_structures::owning_ref::StableAddress for MetadataBlob {}
 
@@ -96,7 +96,7 @@ crate struct CrateMetadata {
     /// Source maps for code from the crate.
     source_map_import_info: OnceCell<Vec<ImportedSourceFile>>,
     /// For every definition in this crate, maps its `DefPathHash` to its `DefIndex`.
-    def_path_hash_map: DefPathHashMap<'static>,
+    def_path_hash_map: DefPathHashMapRef<'static>,
     /// Likewise for ExpnHash.
     expn_hash_map: OnceCell<UnhashMap<ExpnHash, ExpnIndex>>,
     /// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
diff --git a/compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs b/compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs
index e2095d553f5..d6435bb649d 100644
--- a/compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs
+++ b/compiler/rustc_metadata/src/rmeta/def_path_hash_map.rs
@@ -2,46 +2,44 @@ use crate::rmeta::DecodeContext;
 use crate::rmeta::EncodeContext;
 use crate::rmeta::MetadataBlob;
 use rustc_data_structures::owning_ref::OwningRef;
-use rustc_hir::def_path_hash_map::{
-    Config as HashMapConfig, DefPathHashMap as DefPathHashMapInner,
-};
+use rustc_hir::def_path_hash_map::{Config as HashMapConfig, DefPathHashMap};
 use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder};
 use rustc_span::def_id::{DefIndex, DefPathHash};
 
-crate enum DefPathHashMap<'tcx> {
+crate enum DefPathHashMapRef<'tcx> {
     OwnedFromMetadata(odht::HashTable<HashMapConfig, OwningRef<MetadataBlob, [u8]>>),
-    BorrowedFromTcx(&'tcx DefPathHashMapInner),
+    BorrowedFromTcx(&'tcx DefPathHashMap),
 }
 
-impl DefPathHashMap<'tcx> {
+impl DefPathHashMapRef<'tcx> {
     #[inline]
     pub fn def_path_hash_to_def_index(&self, def_path_hash: &DefPathHash) -> DefIndex {
         match *self {
-            DefPathHashMap::OwnedFromMetadata(ref map) => map.get(def_path_hash).unwrap(),
-            DefPathHashMap::BorrowedFromTcx(_) => {
+            DefPathHashMapRef::OwnedFromMetadata(ref map) => map.get(def_path_hash).unwrap(),
+            DefPathHashMapRef::BorrowedFromTcx(_) => {
                 panic!("DefPathHashMap::BorrowedFromTcx variant only exists for serialization")
             }
         }
     }
 }
 
-impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for DefPathHashMap<'tcx> {
+impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for DefPathHashMapRef<'tcx> {
     fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> opaque::EncodeResult {
         match *self {
-            DefPathHashMap::BorrowedFromTcx(def_path_hash_map) => {
+            DefPathHashMapRef::BorrowedFromTcx(def_path_hash_map) => {
                 let bytes = def_path_hash_map.raw_bytes();
                 e.emit_usize(bytes.len())?;
                 e.emit_raw_bytes(bytes)
             }
-            DefPathHashMap::OwnedFromMetadata(_) => {
+            DefPathHashMapRef::OwnedFromMetadata(_) => {
                 panic!("DefPathHashMap::OwnedFromMetadata variant only exists for deserialization")
             }
         }
     }
 }
 
-impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for DefPathHashMap<'static> {
-    fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<DefPathHashMap<'static>, String> {
+impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for DefPathHashMapRef<'static> {
+    fn decode(d: &mut DecodeContext<'a, 'tcx>) -> Result<DefPathHashMapRef<'static>, String> {
         // Import TyDecoder so we can access the DecodeContext::position() method
         use crate::rustc_middle::ty::codec::TyDecoder;
 
@@ -55,6 +53,6 @@ impl<'a, 'tcx> Decodable<DecodeContext<'a, 'tcx>> for DefPathHashMap<'static> {
         let _ = d.read_raw_bytes(len);
 
         let inner = odht::HashTable::from_raw_bytes(o).map_err(|e| format!("{}", e))?;
-        Ok(DefPathHashMap::OwnedFromMetadata(inner))
+        Ok(DefPathHashMapRef::OwnedFromMetadata(inner))
     }
 }
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index 5a901e33df9..a50c4549d3d 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1,4 +1,4 @@
-use crate::rmeta::def_path_hash_map::DefPathHashMap;
+use crate::rmeta::def_path_hash_map::DefPathHashMapRef;
 use crate::rmeta::table::{FixedSizeEncoding, TableBuilder};
 use crate::rmeta::*;
 
@@ -473,8 +473,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
         }
     }
 
-    fn encode_def_path_hash_map(&mut self) -> Lazy<DefPathHashMap<'tcx>> {
-        self.lazy(DefPathHashMap::BorrowedFromTcx(
+    fn encode_def_path_hash_map(&mut self) -> Lazy<DefPathHashMapRef<'tcx>> {
+        self.lazy(DefPathHashMapRef::BorrowedFromTcx(
             self.tcx.resolutions(()).definitions.def_path_hash_to_def_index_map(),
         ))
     }
diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs
index d47537b86ab..eb2bd80f46e 100644
--- a/compiler/rustc_metadata/src/rmeta/mod.rs
+++ b/compiler/rustc_metadata/src/rmeta/mod.rs
@@ -1,5 +1,5 @@
 use decoder::Metadata;
-use def_path_hash_map::DefPathHashMap;
+use def_path_hash_map::DefPathHashMapRef;
 use table::{Table, TableBuilder};
 
 use rustc_ast::{self as ast, MacroDef};
@@ -233,7 +233,7 @@ crate struct CrateRoot<'tcx> {
     expn_data: ExpnDataTable,
     expn_hashes: ExpnHashTable,
 
-    def_path_hash_map: Lazy<DefPathHashMap<'tcx>>,
+    def_path_hash_map: Lazy<DefPathHashMapRef<'tcx>>,
 
     source_map: Lazy<[rustc_span::SourceFile]>,