Skip to content

Commit 4c8105e

Browse files
committed
rustc_metadata: Privatize some fields and methods of CStore
After it's moved to `creader.rs`
1 parent 753ce45 commit 4c8105e

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/librustc_metadata/creader.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use rustc_error_codes::*;
3636
#[derive(Clone)]
3737
pub struct CStore {
3838
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>,
39-
crate injected_panic_runtime: Option<CrateNum>,
40-
crate allocator_kind: Option<AllocatorKind>,
39+
injected_panic_runtime: Option<CrateNum>,
40+
allocator_kind: Option<AllocatorKind>,
4141
}
4242

4343
pub struct CrateLoader<'a> {
@@ -91,7 +91,7 @@ fn dump_crates(cstore: &CStore) {
9191
}
9292

9393
impl CStore {
94-
crate fn alloc_new_crate_num(&mut self) -> CrateNum {
94+
fn alloc_new_crate_num(&mut self) -> CrateNum {
9595
self.metas.push(None);
9696
CrateNum::new(self.metas.len() - 1)
9797
}
@@ -101,7 +101,7 @@ impl CStore {
101101
.unwrap_or_else(|| panic!("Failed to get crate data for {:?}", cnum))
102102
}
103103

104-
crate fn set_crate_data(&mut self, cnum: CrateNum, data: CrateMetadata) {
104+
fn set_crate_data(&mut self, cnum: CrateNum, data: CrateMetadata) {
105105
assert!(self.metas[cnum].is_none(), "Overwriting crate metadata entry");
106106
self.metas[cnum] = Some(Lrc::new(data));
107107
}
@@ -137,11 +137,19 @@ impl CStore {
137137
deps
138138
}
139139

140-
crate fn crate_dependencies_in_reverse_postorder(&self, cnum: CrateNum) -> Vec<CrateNum> {
140+
fn crate_dependencies_in_reverse_postorder(&self, cnum: CrateNum) -> Vec<CrateNum> {
141141
let mut deps = self.crate_dependencies_in_postorder(cnum);
142142
deps.reverse();
143143
deps
144144
}
145+
146+
crate fn injected_panic_runtime(&self) -> Option<CrateNum> {
147+
self.injected_panic_runtime
148+
}
149+
150+
crate fn allocator_kind(&self) -> Option<AllocatorKind> {
151+
self.allocator_kind
152+
}
145153
}
146154

147155
impl<'a> CrateLoader<'a> {

src/librustc_metadata/rmeta/decoder/cstore_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,10 @@ impl CrateStore for CStore {
530530
}
531531

532532
fn injected_panic_runtime(&self) -> Option<CrateNum> {
533-
self.injected_panic_runtime
533+
self.injected_panic_runtime()
534534
}
535535

536536
fn allocator_kind(&self) -> Option<AllocatorKind> {
537-
self.allocator_kind
537+
self.allocator_kind()
538538
}
539539
}

0 commit comments

Comments
 (0)