Skip to content

Commit

Permalink
rustc_metadata: Remove some dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Dec 2, 2020
1 parent af69066 commit 908bf5a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 28 deletions.
17 changes: 0 additions & 17 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Expand Up @@ -1592,23 +1592,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
self.def_path_hash_unlocked(index, &mut def_path_hashes)
}

fn all_def_path_hashes_and_def_ids(&self) -> Vec<(DefPathHash, DefId)> {
let mut def_path_hashes = self.def_path_hash_cache.lock();
let mut def_index_to_data = |index| {
(self.def_path_hash_unlocked(index, &mut def_path_hashes), self.local_def_id(index))
};
if let Some(data) = &self.root.proc_macro_data {
std::iter::once(CRATE_DEF_INDEX)
.chain(data.macros.decode(self))
.map(def_index_to_data)
.collect()
} else {
(0..self.num_def_ids())
.map(|index| def_index_to_data(DefIndex::from_usize(index)))
.collect()
}
}

/// Get the `DepNodeIndex` corresponding this crate. The result of this
/// method is cached in the `dep_node_index` field.
fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex {
Expand Down
12 changes: 4 additions & 8 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Expand Up @@ -456,6 +456,10 @@ impl CStore {
pub fn module_expansion_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId {
self.get_crate_data(def_id.krate).module_expansion(def_id.index, sess)
}

pub fn num_def_ids(&self, cnum: CrateNum) -> usize {
self.get_crate_data(cnum).num_def_ids()
}
}

impl CrateStore for CStore {
Expand Down Expand Up @@ -498,14 +502,6 @@ impl CrateStore for CStore {
self.get_crate_data(def.krate).def_path_hash(def.index)
}

fn all_def_path_hashes_and_def_ids(&self, cnum: CrateNum) -> Vec<(DefPathHash, DefId)> {
self.get_crate_data(cnum).all_def_path_hashes_and_def_ids()
}

fn num_def_ids(&self, cnum: CrateNum) -> usize {
self.get_crate_data(cnum).num_def_ids()
}

// See `CrateMetadataRef::def_path_hash_to_def_id` for more details
fn def_path_hash_to_def_id(
&self,
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/middle/cstore.rs
Expand Up @@ -189,8 +189,6 @@ pub trait CrateStore {
fn def_kind(&self, def: DefId) -> DefKind;
fn def_path(&self, def: DefId) -> DefPath;
fn def_path_hash(&self, def: DefId) -> DefPathHash;
fn all_def_path_hashes_and_def_ids(&self, cnum: CrateNum) -> Vec<(DefPathHash, DefId)>;
fn num_def_ids(&self, cnum: CrateNum) -> usize;
fn def_path_hash_to_def_id(
&self,
cnum: CrateNum,
Expand Down
1 change: 0 additions & 1 deletion src/librustdoc/core.rs
Expand Up @@ -13,7 +13,6 @@ use rustc_hir::{
};
use rustc_interface::interface;
use rustc_middle::hir::map::Map;
use rustc_middle::middle::cstore::CrateStore;
use rustc_middle::middle::privacy::AccessLevels;
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_resolve as resolve;
Expand Down

0 comments on commit 908bf5a

Please sign in to comment.