1
Fork 0

rustc_metadata: Privatize more entities

This commit is contained in:
Vadim Petrochenkov 2019-11-03 18:27:24 +03:00
parent 166d5f8b2f
commit 2b75147451
3 changed files with 14 additions and 15 deletions

View file

@ -24,7 +24,6 @@ use std::marker::PhantomData;
use std::num::NonZeroUsize; use std::num::NonZeroUsize;
pub use decoder::{provide, provide_extern}; pub use decoder::{provide, provide_extern};
crate use encoder::encode_metadata;
mod decoder; mod decoder;
mod encoder; mod encoder;
@ -178,16 +177,16 @@ macro_rules! Lazy {
crate struct CrateRoot<'tcx> { crate struct CrateRoot<'tcx> {
pub name: Symbol, pub name: Symbol,
pub triple: TargetTriple, pub triple: TargetTriple,
pub extra_filename: String, extra_filename: String,
pub hash: Svh, pub hash: Svh,
pub disambiguator: CrateDisambiguator, pub disambiguator: CrateDisambiguator,
pub panic_strategy: PanicStrategy, pub panic_strategy: PanicStrategy,
pub edition: Edition, edition: Edition,
pub has_global_allocator: bool, pub has_global_allocator: bool,
pub has_panic_handler: bool, has_panic_handler: bool,
pub has_default_lib_allocator: bool, pub has_default_lib_allocator: bool,
pub plugin_registrar_fn: Option<DefIndex>, plugin_registrar_fn: Option<DefIndex>,
pub proc_macro_decls_static: Option<DefIndex>, proc_macro_decls_static: Option<DefIndex>,
proc_macro_stability: Option<attr::Stability>, proc_macro_stability: Option<attr::Stability>,
pub crate_deps: Lazy<[CrateDep]>, pub crate_deps: Lazy<[CrateDep]>,
@ -210,14 +209,14 @@ crate struct CrateRoot<'tcx> {
/// this crate /// this crate
pub proc_macro_data: Option<Lazy<[DefIndex]>>, pub proc_macro_data: Option<Lazy<[DefIndex]>>,
pub compiler_builtins: bool, compiler_builtins: bool,
pub needs_allocator: bool, pub needs_allocator: bool,
pub needs_panic_runtime: bool, pub needs_panic_runtime: bool,
pub no_builtins: bool, no_builtins: bool,
pub panic_runtime: bool, pub panic_runtime: bool,
pub profiler_runtime: bool, pub profiler_runtime: bool,
pub sanitizer_runtime: bool, pub sanitizer_runtime: bool,
pub symbol_mangling_version: SymbolManglingVersion, symbol_mangling_version: SymbolManglingVersion,
} }
#[derive(RustcEncodable, RustcDecodable)] #[derive(RustcEncodable, RustcDecodable)]
@ -313,9 +312,9 @@ struct ModData {
} }
#[derive(RustcEncodable, RustcDecodable)] #[derive(RustcEncodable, RustcDecodable)]
crate struct MacroDef { struct MacroDef {
pub body: String, body: String,
pub legacy: bool, legacy: bool,
} }
#[derive(RustcEncodable, RustcDecodable)] #[derive(RustcEncodable, RustcDecodable)]

View file

@ -2,7 +2,7 @@ use crate::cstore::{self, LoadedMacro};
use crate::link_args; use crate::link_args;
use crate::native_libs; use crate::native_libs;
use crate::foreign_modules; use crate::foreign_modules;
use crate::schema; use crate::schema::{self, encoder};
use rustc::ty::query::QueryConfig; use rustc::ty::query::QueryConfig;
use rustc::middle::cstore::{CrateSource, CrateStore, DepKind, EncodedMetadata, NativeLibraryKind}; 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 { fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata {
schema::encode_metadata(tcx) encoder::encode_metadata(tcx)
} }
fn metadata_encoding_version(&self) -> &[u8] fn metadata_encoding_version(&self) -> &[u8]

View file

@ -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 // will allow us to slice the metadata to the precise length that we just
// generated regardless of trailing bytes that end up in it. // 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![]); let mut encoder = opaque::Encoder::new(vec![]);
encoder.emit_raw_bytes(METADATA_HEADER); encoder.emit_raw_bytes(METADATA_HEADER);