about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-05-23 20:29:01 +0300
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-15 18:23:50 +0300
commitf49274032bc2819c6f9acaaf4e85e5200fc8bbba (patch)
tree97bd3ca552f9690491e033234670941ebb485649 /src
parent83b3c392187003236aafe10e153816c13f7b896d (diff)
downloadrust-f49274032bc2819c6f9acaaf4e85e5200fc8bbba.tar.gz
rust-f49274032bc2819c6f9acaaf4e85e5200fc8bbba.zip
rustc_metadata: rename index::Index to table::Table.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_metadata/decoder.rs2
-rw-r--r--src/librustc_metadata/encoder.rs16
-rw-r--r--src/librustc_metadata/lib.rs10
-rw-r--r--src/librustc_metadata/schema.rs4
-rw-r--r--src/librustc_metadata/table.rs (renamed from src/librustc_metadata/index.rs)14
5 files changed, 23 insertions, 23 deletions
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index a2955212bd4..684dfd69d2d 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -472,7 +472,7 @@ impl<'a, 'tcx> CrateMetadata {
     }
 
     fn maybe_entry(&self, item_id: DefIndex) -> Option<Lazy<Entry<'tcx>>> {
-        self.root.entries_index.lookup(self.blob.raw_bytes(), item_id)
+        self.root.entries_table.lookup(self.blob.raw_bytes(), item_id)
     }
 
     fn entry(&self, item_id: DefIndex) -> Entry<'tcx> {
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 76bac125126..abfee8eaa3c 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -1,5 +1,5 @@
-use crate::index::Index;
 use crate::schema::*;
+use crate::table::Table;
 
 use rustc::middle::cstore::{LinkagePreference, NativeLibrary,
                             EncodedMetadata, ForeignModule};
@@ -47,7 +47,7 @@ struct EncodeContext<'tcx> {
     opaque: opaque::Encoder,
     tcx: TyCtxt<'tcx>,
 
-    entries_index: Index<'tcx>,
+    entries_table: Table<'tcx>,
 
     lazy_state: LazyState,
     type_shorthands: FxHashMap<Ty<'tcx>, usize>,
@@ -325,7 +325,7 @@ impl<'tcx> EncodeContext<'tcx> {
 
         let entry = op(self, data);
         let entry = self.lazy(entry);
-        self.entries_index.record(id, entry);
+        self.entries_table.record(id, entry);
     }
 
     fn encode_info_for_items(&mut self) {
@@ -477,8 +477,8 @@ impl<'tcx> EncodeContext<'tcx> {
 
 
         i = self.position();
-        let entries_index = self.entries_index.write_index(&mut self.opaque);
-        let entries_index_bytes = self.position() - i;
+        let entries_table = self.entries_table.encode(&mut self.opaque);
+        let entries_table_bytes = self.position() - i;
 
         // Encode the proc macro data
         i = self.position();
@@ -537,7 +537,7 @@ impl<'tcx> EncodeContext<'tcx> {
             impls,
             exported_symbols,
             interpret_alloc_index,
-            entries_index,
+            entries_table,
         });
 
         let total_bytes = self.position();
@@ -562,7 +562,7 @@ impl<'tcx> EncodeContext<'tcx> {
             println!("  def-path table bytes: {}", def_path_table_bytes);
             println!(" proc-macro-data-bytes: {}", proc_macro_data_bytes);
             println!("            item bytes: {}", item_bytes);
-            println!("   entries index bytes: {}", entries_index_bytes);
+            println!("   entries table bytes: {}", entries_table_bytes);
             println!("            zero bytes: {}", zero_bytes);
             println!("           total bytes: {}", total_bytes);
         }
@@ -1916,7 +1916,7 @@ crate fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
         let mut ecx = EncodeContext {
             opaque: encoder,
             tcx,
-            entries_index: Index::new(tcx.hir().definitions().def_index_count()),
+            entries_table: Table::new(tcx.hir().definitions().def_index_count()),
             lazy_state: LazyState::NoNode,
             type_shorthands: Default::default(),
             predicate_shorthands: Default::default(),
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index 6aa684b1c3d..291ee23ff72 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -26,15 +26,15 @@ extern crate rustc_data_structures;
 
 pub mod error_codes;
 
-mod index;
 mod encoder;
 mod decoder;
+mod dependency_format;
 mod cstore_impl;
-mod schema;
-mod native_libs;
-mod link_args;
 mod foreign_modules;
-mod dependency_format;
+mod link_args;
+mod native_libs;
+mod schema;
+mod table;
 
 pub mod creader;
 pub mod cstore;
diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs
index 9541e5c39cd..52bbebb17f2 100644
--- a/src/librustc_metadata/schema.rs
+++ b/src/librustc_metadata/schema.rs
@@ -1,4 +1,4 @@
-use crate::index;
+use crate::table::Table;
 
 use rustc::hir;
 use rustc::hir::def::{self, CtorKind};
@@ -186,7 +186,7 @@ crate struct CrateRoot<'tcx> {
     pub exported_symbols: Lazy<[(ExportedSymbol<'tcx>, SymbolExportLevel)]>,
     pub interpret_alloc_index: Lazy<[u32]>,
 
-    pub entries_index: Lazy<[index::Index<'tcx>]>,
+    pub entries_table: Lazy<[Table<'tcx>]>,
 
     /// The DefIndex's of any proc macros delcared by
     /// this crate
diff --git a/src/librustc_metadata/index.rs b/src/librustc_metadata/table.rs
index d37765120be..c53d6990704 100644
--- a/src/librustc_metadata/index.rs
+++ b/src/librustc_metadata/table.rs
@@ -76,14 +76,14 @@ impl FixedSizeEncoding for u32 {
 /// `0`. Whenever an index is visited, we fill in the
 /// appropriate spot by calling `record_position`. We should never
 /// visit the same index twice.
-crate struct Index<'tcx> {
+crate struct Table<'tcx> {
     positions: Vec<u8>,
     _marker: PhantomData<&'tcx ()>,
 }
 
-impl Index<'tcx> {
+impl Table<'tcx> {
     crate fn new(max_index: usize) -> Self {
-        Index {
+        Table {
             positions: vec![0; max_index * 4],
             _marker: PhantomData,
         }
@@ -108,7 +108,7 @@ impl Index<'tcx> {
         position.write_to_bytes_at(positions, array_index)
     }
 
-    crate fn write_index(&self, buf: &mut Encoder) -> Lazy<[Self]> {
+    crate fn encode(&self, buf: &mut Encoder) -> Lazy<[Self]> {
         let pos = buf.position();
         buf.emit_raw_bytes(&self.positions);
         Lazy::from_position_and_meta(
@@ -118,18 +118,18 @@ impl Index<'tcx> {
     }
 }
 
-impl Lazy<[Index<'tcx>]> {
+impl Lazy<[Table<'tcx>]> {
     /// Given the metadata, extract out the offset of a particular
     /// DefIndex (if any).
     #[inline(never)]
     crate fn lookup(&self, bytes: &[u8], def_index: DefIndex) -> Option<Lazy<Entry<'tcx>>> {
-        debug!("Index::lookup: index={:?} len={:?}",
+        debug!("Table::lookup: index={:?} len={:?}",
                def_index,
                self.meta);
 
         let bytes = &bytes[self.position.get()..][..self.meta * 4];
         let position = u32::read_from_bytes_at(bytes, def_index.index());
-        debug!("Index::lookup: position={:?}", position);
+        debug!("Table::lookup: position={:?}", position);
         NonZeroUsize::new(position as usize).map(Lazy::from_position)
     }
 }