Skip to content

Commit 996d94a

Browse files
authored
Rollup merge of #66056 - petrochenkov:metapriv, r=eddyb
rustc_metadata: Some reorganization of the module structure The new structure of `rustc_metadata` (or rather its parts affected by the refactoring) is ``` ├── lib.rs └── rmeta ├── decoder │   └── cstore_impl.rs ├── decoder.rs ├── encoder.rs ├── mod.rs └── table.rs ``` (`schema` is renamed to `rmeta`.) The code inside `rmeta` is pretty self-contained, so we can now privatize almost everything in this module instead of using `pub(crate)` which was necessary when all these modules accessed their neighbors in the old flat structure. `encoder` and `decoder` work with structures defined by `rmeta`. `table` is a part of `rmeta`. `cstore_impl` actively uses decoder methods and exposes their results through very few public methods (`provide` and `_untracked` methods). r? @eddyb @spastorino
2 parents 9dc5d0e + 5eb1cf1 commit 996d94a

File tree

9 files changed

+171
-169
lines changed

9 files changed

+171
-169
lines changed

src/librustc_metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::cstore::{self, CStore, MetadataBlob};
44
use crate::locator::{self, CratePaths};
5-
use crate::schema::{CrateRoot, CrateDep};
5+
use crate::rmeta::{CrateRoot, CrateDep};
66
use rustc_data_structures::sync::{Lock, Once, AtomicCell};
77

88
use rustc::hir::def_id::CrateNum;

src/librustc_metadata/cstore.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// The crate store - a central repo for information collected about external
22
// crates and libraries
33

4-
use crate::schema;
4+
use crate::rmeta;
55
use rustc::dep_graph::DepNodeIndex;
66
use rustc::hir::def_id::{CrateNum, DefIndex};
77
use rustc::hir::map::definitions::DefPathTable;
@@ -17,7 +17,7 @@ use syntax_expand::base::SyntaxExtension;
1717
use syntax_pos;
1818
use proc_macro::bridge::client::ProcMacro;
1919

20-
pub use crate::cstore_impl::{provide, provide_extern};
20+
pub use crate::rmeta::{provide, provide_extern};
2121

2222
// A map from external crate numbers (as decoded from some crate file) to
2323
// local crate numbers (as generated during this session). Each external
@@ -49,7 +49,7 @@ crate struct CrateMetadata {
4949
/// lifetime is only used behind `Lazy`, and therefore acts like an
5050
/// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt`
5151
/// is being used to decode those values.
52-
crate root: schema::CrateRoot<'static>,
52+
crate root: rmeta::CrateRoot<'static>,
5353
/// For each definition in this crate, we encode a key. When the
5454
/// crate is loaded, we read all the keys and put them in this
5555
/// hashmap, which gives the reverse mapping. This allows us to
@@ -59,7 +59,7 @@ crate struct CrateMetadata {
5959
/// Trait impl data.
6060
/// FIXME: Used only from queries and can use query cache,
6161
/// so pre-decoding can probably be avoided.
62-
crate trait_impls: FxHashMap<(u32, DefIndex), schema::Lazy<[DefIndex]>>,
62+
crate trait_impls: FxHashMap<(u32, DefIndex), rmeta::Lazy<[DefIndex]>>,
6363
/// Proc macro descriptions for this crate, if it's a proc macro crate.
6464
crate raw_proc_macros: Option<&'static [ProcMacro]>,
6565
/// Source maps for code from the crate.

src/librustc_metadata/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ extern crate rustc_data_structures;
2626

2727
pub mod error_codes;
2828

29-
mod encoder;
30-
mod decoder;
3129
mod dependency_format;
32-
mod cstore_impl;
3330
mod foreign_modules;
3431
mod link_args;
3532
mod native_libs;
36-
mod schema;
37-
mod table;
33+
mod rmeta;
3834

3935
pub mod creader;
4036
pub mod cstore;

src/librustc_metadata/locator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
215215
use crate::cstore::MetadataBlob;
216216
use crate::creader::Library;
217-
use crate::schema::{METADATA_HEADER, rustc_version};
217+
use crate::rmeta::{METADATA_HEADER, rustc_version};
218218

219219
use rustc_data_structures::fx::FxHashSet;
220220
use rustc_data_structures::svh::Svh;

0 commit comments

Comments
 (0)