From 2b75147451ffe8654963b3399df40d40c6ed0ff2 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 18:27:24 +0300 Subject: [PATCH] rustc_metadata: Privatize more entities --- src/librustc_metadata/schema.rs | 23 +++++++++---------- .../schema/decoder/cstore_impl.rs | 4 ++-- src/librustc_metadata/schema/encoder.rs | 2 +- 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, - pub proc_macro_decls_static: Option, + plugin_registrar_fn: Option, + proc_macro_decls_static: Option, proc_macro_stability: Option, pub crate_deps: Lazy<[CrateDep]>, @@ -210,14 +209,14 @@ crate struct CrateRoot<'tcx> { /// this crate pub proc_macro_data: Option>, - 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);