Skip to content

Commit

Permalink
Adapt some method visibilities in librustc_metadata::cstore.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed May 9, 2018
1 parent 295d980 commit 31d2012
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/librustc_metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ impl CStore {

/// You cannot use this function to allocate a CrateNum in a thread-safe manner.
/// It is currently only used in CrateLoader which is single-threaded code.
pub fn next_crate_num(&self) -> CrateNum {
pub(super) fn next_crate_num(&self) -> CrateNum {
CrateNum::new(self.metas.borrow().len() + 1)
}

pub fn get_crate_data(&self, cnum: CrateNum) -> Lrc<CrateMetadata> {
pub(super) fn get_crate_data(&self, cnum: CrateNum) -> Lrc<CrateMetadata> {
self.metas.borrow()[cnum].clone().unwrap()
}

pub fn set_crate_data(&self, cnum: CrateNum, data: Lrc<CrateMetadata>) {
pub(super) fn set_crate_data(&self, cnum: CrateNum, data: Lrc<CrateMetadata>) {
use rustc_data_structures::indexed_vec::Idx;
let mut met = self.metas.borrow_mut();
while met.len() <= cnum.index() {
Expand All @@ -121,7 +121,7 @@ impl CStore {
met[cnum] = Some(data);
}

pub fn iter_crate_data<I>(&self, mut i: I)
pub(super) fn iter_crate_data<I>(&self, mut i: I)
where I: FnMut(CrateNum, &Lrc<CrateMetadata>)
{
for (k, v) in self.metas.borrow().iter_enumerated() {
Expand All @@ -131,14 +131,16 @@ impl CStore {
}
}

pub fn crate_dependencies_in_rpo(&self, krate: CrateNum) -> Vec<CrateNum> {
pub(super) fn crate_dependencies_in_rpo(&self, krate: CrateNum) -> Vec<CrateNum> {
let mut ordering = Vec::new();
self.push_dependencies_in_postorder(&mut ordering, krate);
ordering.reverse();
ordering
}

pub fn push_dependencies_in_postorder(&self, ordering: &mut Vec<CrateNum>, krate: CrateNum) {
pub(super) fn push_dependencies_in_postorder(&self,
ordering: &mut Vec<CrateNum>,
krate: CrateNum) {
if ordering.contains(&krate) {
return;
}
Expand All @@ -153,7 +155,7 @@ impl CStore {
ordering.push(krate);
}

pub fn do_postorder_cnums_untracked(&self) -> Vec<CrateNum> {
pub(super) fn do_postorder_cnums_untracked(&self) -> Vec<CrateNum> {
let mut ordering = Vec::new();
for (num, v) in self.metas.borrow().iter_enumerated() {
if let &Some(_) = v {
Expand All @@ -163,11 +165,11 @@ impl CStore {
return ordering
}

pub fn add_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId, cnum: CrateNum) {
pub(super) fn add_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId, cnum: CrateNum) {
self.extern_mod_crate_map.borrow_mut().insert(emod_id, cnum);
}

pub fn do_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum> {
pub(super) fn do_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum> {
self.extern_mod_crate_map.borrow().get(&emod_id).cloned()
}
}
Expand Down

0 comments on commit 31d2012

Please sign in to comment.