rustc_metadata: Remove some dead code

This commit is contained in:
Vadim Petrochenkov 2020-12-02 23:39:05 +03:00
parent af69066aa6
commit 908bf5a310
4 changed files with 4 additions and 28 deletions

View file

@ -1592,23 +1592,6 @@ fn def_path_hash(&self, index: DefIndex) -> DefPathHash {
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 {

View file

@ -456,6 +456,10 @@ pub fn item_generics_num_lifetimes(&self, def_id: DefId, sess: &Session) -> usiz
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 {
@ -498,14 +502,6 @@ fn def_path_hash(&self, def: DefId) -> DefPathHash {
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,

View file

@ -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,

View file

@ -13,7 +13,6 @@
};
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;