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 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
self.def_path_hash_unlocked(index, &mut def_path_hashes) 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 /// Get the `DepNodeIndex` corresponding this crate. The result of this
/// method is cached in the `dep_node_index` field. /// method is cached in the `dep_node_index` field.
fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex {

View File

@ -456,6 +456,10 @@ impl CStore {
pub fn module_expansion_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId { 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) 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 { impl CrateStore for CStore {
@ -498,14 +502,6 @@ impl CrateStore for CStore {
self.get_crate_data(def.krate).def_path_hash(def.index) 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 // See `CrateMetadataRef::def_path_hash_to_def_id` for more details
fn def_path_hash_to_def_id( fn def_path_hash_to_def_id(
&self, &self,

View File

@ -189,8 +189,6 @@ pub trait CrateStore {
fn def_kind(&self, def: DefId) -> DefKind; fn def_kind(&self, def: DefId) -> DefKind;
fn def_path(&self, def: DefId) -> DefPath; fn def_path(&self, def: DefId) -> DefPath;
fn def_path_hash(&self, def: DefId) -> DefPathHash; 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( fn def_path_hash_to_def_id(
&self, &self,
cnum: CrateNum, cnum: CrateNum,

View File

@ -13,7 +13,6 @@ use rustc_hir::{
}; };
use rustc_interface::interface; use rustc_interface::interface;
use rustc_middle::hir::map::Map; use rustc_middle::hir::map::Map;
use rustc_middle::middle::cstore::CrateStore;
use rustc_middle::middle::privacy::AccessLevels; use rustc_middle::middle::privacy::AccessLevels;
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt}; use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_resolve as resolve; use rustc_resolve as resolve;