rustc_metadata: Privatize some fields and methods of CStore
After it's moved to `creader.rs`
This commit is contained in:
parent
753ce4518e
commit
4c8105e8b7
2 changed files with 15 additions and 7 deletions
|
@ -36,8 +36,8 @@ use rustc_error_codes::*;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CStore {
|
pub struct CStore {
|
||||||
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>,
|
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>,
|
||||||
crate injected_panic_runtime: Option<CrateNum>,
|
injected_panic_runtime: Option<CrateNum>,
|
||||||
crate allocator_kind: Option<AllocatorKind>,
|
allocator_kind: Option<AllocatorKind>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CrateLoader<'a> {
|
pub struct CrateLoader<'a> {
|
||||||
|
@ -91,7 +91,7 @@ fn dump_crates(cstore: &CStore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CStore {
|
impl CStore {
|
||||||
crate fn alloc_new_crate_num(&mut self) -> CrateNum {
|
fn alloc_new_crate_num(&mut self) -> CrateNum {
|
||||||
self.metas.push(None);
|
self.metas.push(None);
|
||||||
CrateNum::new(self.metas.len() - 1)
|
CrateNum::new(self.metas.len() - 1)
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ impl CStore {
|
||||||
.unwrap_or_else(|| panic!("Failed to get crate data for {:?}", cnum))
|
.unwrap_or_else(|| panic!("Failed to get crate data for {:?}", cnum))
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn set_crate_data(&mut self, cnum: CrateNum, data: CrateMetadata) {
|
fn set_crate_data(&mut self, cnum: CrateNum, data: CrateMetadata) {
|
||||||
assert!(self.metas[cnum].is_none(), "Overwriting crate metadata entry");
|
assert!(self.metas[cnum].is_none(), "Overwriting crate metadata entry");
|
||||||
self.metas[cnum] = Some(Lrc::new(data));
|
self.metas[cnum] = Some(Lrc::new(data));
|
||||||
}
|
}
|
||||||
|
@ -137,11 +137,19 @@ impl CStore {
|
||||||
deps
|
deps
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn crate_dependencies_in_reverse_postorder(&self, cnum: CrateNum) -> Vec<CrateNum> {
|
fn crate_dependencies_in_reverse_postorder(&self, cnum: CrateNum) -> Vec<CrateNum> {
|
||||||
let mut deps = self.crate_dependencies_in_postorder(cnum);
|
let mut deps = self.crate_dependencies_in_postorder(cnum);
|
||||||
deps.reverse();
|
deps.reverse();
|
||||||
deps
|
deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crate fn injected_panic_runtime(&self) -> Option<CrateNum> {
|
||||||
|
self.injected_panic_runtime
|
||||||
|
}
|
||||||
|
|
||||||
|
crate fn allocator_kind(&self) -> Option<AllocatorKind> {
|
||||||
|
self.allocator_kind
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CrateLoader<'a> {
|
impl<'a> CrateLoader<'a> {
|
||||||
|
|
|
@ -530,10 +530,10 @@ impl CrateStore for CStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn injected_panic_runtime(&self) -> Option<CrateNum> {
|
fn injected_panic_runtime(&self) -> Option<CrateNum> {
|
||||||
self.injected_panic_runtime
|
self.injected_panic_runtime()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allocator_kind(&self) -> Option<AllocatorKind> {
|
fn allocator_kind(&self) -> Option<AllocatorKind> {
|
||||||
self.allocator_kind
|
self.allocator_kind()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue