about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-03 18:27:24 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-07 21:06:47 +0300
commit2b75147451ffe8654963b3399df40d40c6ed0ff2 (patch)
treefdaeb975fce46b67277b023f31d2c98e814fbb1c
parent166d5f8b2fa853e3fa14a719c13d59b7b7160237 (diff)
downloadrust-2b75147451ffe8654963b3399df40d40c6ed0ff2.tar.gz
rust-2b75147451ffe8654963b3399df40d40c6ed0ff2.zip
rustc_metadata: Privatize more entities
-rw-r--r--src/librustc_metadata/schema.rs23
-rw-r--r--src/librustc_metadata/schema/decoder/cstore_impl.rs4
-rw-r--r--src/librustc_metadata/schema/encoder.rs2
3 files changed, 14 insertions, 15 deletions
diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs
index e7b56fed50a..4eabeac6d98 100644
--- a/src/librustc_metadata/schema.rs
+++ b/src/librustc_metadata/schema.rs
@@ -24,7 +24,6 @@ use std::marker::PhantomData;
 use std::num::NonZeroUsize;
 
 pub use decoder::{provide, provide_extern};
-crate use encoder::encode_metadata;
 
 mod decoder;
 mod encoder;
@@ -178,16 +177,16 @@ macro_rules! Lazy {
 crate struct CrateRoot<'tcx> {
     pub name: Symbol,
     pub triple: TargetTriple,
-    pub extra_filename: String,
+    extra_filename: String,
     pub hash: Svh,
     pub disambiguator: CrateDisambiguator,
     pub panic_strategy: PanicStrategy,
-    pub edition: Edition,
+    edition: Edition,
     pub has_global_allocator: bool,
-    pub has_panic_handler: bool,
+    has_panic_handler: bool,
     pub has_default_lib_allocator: bool,
-    pub plugin_registrar_fn: Option<DefIndex>,
-    pub proc_macro_decls_static: Option<DefIndex>,
+    plugin_registrar_fn: Option<DefIndex>,
+    proc_macro_decls_static: Option<DefIndex>,
     proc_macro_stability: Option<attr::Stability>,
 
     pub crate_deps: Lazy<[CrateDep]>,
@@ -210,14 +209,14 @@ crate struct CrateRoot<'tcx> {
     /// this crate
     pub proc_macro_data: Option<Lazy<[DefIndex]>>,
 
-    pub compiler_builtins: bool,
+    compiler_builtins: bool,
     pub needs_allocator: bool,
     pub needs_panic_runtime: bool,
-    pub no_builtins: bool,
+    no_builtins: bool,
     pub panic_runtime: bool,
     pub profiler_runtime: bool,
     pub sanitizer_runtime: bool,
-    pub symbol_mangling_version: SymbolManglingVersion,
+    symbol_mangling_version: SymbolManglingVersion,
 }
 
 #[derive(RustcEncodable, RustcDecodable)]
@@ -313,9 +312,9 @@ struct ModData {
 }
 
 #[derive(RustcEncodable, RustcDecodable)]
-crate struct MacroDef {
-    pub body: String,
-    pub legacy: bool,
+struct MacroDef {
+    body: String,
+    legacy: bool,
 }
 
 #[derive(RustcEncodable, RustcDecodable)]
diff --git a/src/librustc_metadata/schema/decoder/cstore_impl.rs b/src/librustc_metadata/schema/decoder/cstore_impl.rs
index 2d3a6f4fa9f..59aa5c7402f 100644
--- a/src/librustc_metadata/schema/decoder/cstore_impl.rs
+++ b/src/librustc_metadata/schema/decoder/cstore_impl.rs
@@ -2,7 +2,7 @@ use crate::cstore::{self, LoadedMacro};
 use crate::link_args;
 use crate::native_libs;
 use crate::foreign_modules;
-use crate::schema;
+use crate::schema::{self, encoder};
 
 use rustc::ty::query::QueryConfig;
 use rustc::middle::cstore::{CrateSource, CrateStore, DepKind, EncodedMetadata, NativeLibraryKind};
@@ -523,7 +523,7 @@ impl CrateStore for cstore::CStore {
     }
 
     fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
-        schema::encode_metadata(tcx)
+        encoder::encode_metadata(tcx)
     }
 
     fn metadata_encoding_version(&self) -> &[u8]
diff --git a/src/librustc_metadata/schema/encoder.rs b/src/librustc_metadata/schema/encoder.rs
index 2119ab9c282..9970d753dbc 100644
--- a/src/librustc_metadata/schema/encoder.rs
+++ b/src/librustc_metadata/schema/encoder.rs
@@ -1781,7 +1781,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
 // will allow us to slice the metadata to the precise length that we just
 // generated regardless of trailing bytes that end up in it.
 
-crate fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
+pub(super) fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
     let mut encoder = opaque::Encoder::new(vec![]);
     encoder.emit_raw_bytes(METADATA_HEADER);