Remove some unused methods from metadata
Address comments + Fix rebase
This commit is contained in:
parent
bd291ce21a
commit
bc0eabd7a7
6 changed files with 14 additions and 26 deletions
|
@ -201,7 +201,6 @@ pub trait CrateStore<'tcx> {
|
|||
-> Option<DefIndex>;
|
||||
fn def_key(&self, def: DefId) -> hir_map::DefKey;
|
||||
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath>;
|
||||
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>;
|
||||
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
|
||||
fn item_children(&self, did: DefId) -> Vec<def::Export>;
|
||||
|
||||
|
@ -377,8 +376,6 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
|
|||
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath> {
|
||||
bug!("relative_def_path")
|
||||
}
|
||||
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>
|
||||
{ bug!("struct_ctor_def_id") }
|
||||
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name> { bug!("struct_field_names") }
|
||||
fn item_children(&self, did: DefId) -> Vec<def::Export> { bug!("item_children") }
|
||||
|
||||
|
|
|
@ -342,12 +342,6 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
|||
self.get_crate_data(def.krate).def_path(def.index)
|
||||
}
|
||||
|
||||
fn struct_ctor_def_id(&self, struct_def_id: DefId) -> Option<DefId>
|
||||
{
|
||||
self.dep_graph.read(DepNode::MetaData(struct_def_id));
|
||||
self.get_crate_data(struct_def_id.krate).get_struct_ctor_def_id(struct_def_id.index)
|
||||
}
|
||||
|
||||
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>
|
||||
{
|
||||
self.dep_graph.read(DepNode::MetaData(def));
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc::hir::def::CtorKind;
|
||||
use rustc::mir::repr::*;
|
||||
use rustc::mir::transform::{MirPass, MirSource, Pass};
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
|
@ -129,10 +128,7 @@ fn get_aggregate_statement_index<'a, 'tcx, 'b>(start: usize,
|
|||
}
|
||||
debug!("getting variant {:?}", variant);
|
||||
debug!("for adt_def {:?}", adt_def);
|
||||
let variant_def = &adt_def.variants[variant];
|
||||
if variant_def.ctor_kind == CtorKind::Fictive {
|
||||
return Some(i);
|
||||
}
|
||||
};
|
||||
None
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ use std::rc::Rc;
|
|||
|
||||
use syntax::ast::Name;
|
||||
use syntax::attr;
|
||||
use syntax::parse::token;
|
||||
|
||||
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind};
|
||||
use syntax::ast::{Mutability, StmtKind, TraitItem, TraitItemKind};
|
||||
|
|
|
@ -451,27 +451,26 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
|
|||
fn handle_external_def(ccx: &CrateCtxt,
|
||||
traits: &mut AllTraitsVec,
|
||||
external_mods: &mut FnvHashSet<DefId>,
|
||||
def_id: DefId) {
|
||||
match ccx.tcx.sess.cstore.describe_def(def_id) {
|
||||
Some(Def::Trait(_)) => {
|
||||
def: Def) {
|
||||
let def_id = def.def_id();
|
||||
match def {
|
||||
Def::Trait(..) => {
|
||||
traits.push(TraitInfo::new(def_id));
|
||||
}
|
||||
Some(Def::Mod(_)) => {
|
||||
Def::Mod(..) => {
|
||||
if !external_mods.insert(def_id) {
|
||||
return;
|
||||
}
|
||||
for child in ccx.tcx.sess.cstore.item_children(def_id) {
|
||||
handle_external_def(ccx, traits, external_mods, child.def.def_id())
|
||||
handle_external_def(ccx, traits, external_mods, child.def)
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
for cnum in ccx.tcx.sess.cstore.crates() {
|
||||
handle_external_def(ccx, &mut traits, &mut external_mods, DefId {
|
||||
krate: cnum,
|
||||
index: CRATE_DEF_INDEX
|
||||
});
|
||||
let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
|
||||
handle_external_def(ccx, &mut traits, &mut external_mods, Def::Mod(def_id));
|
||||
}
|
||||
|
||||
*ccx.all_traits.borrow_mut() = Some(traits);
|
||||
|
|
|
@ -66,11 +66,12 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> {
|
|||
|
||||
pub fn visit_mod(&mut self, def_id: DefId) {
|
||||
for item in self.cstore.item_children(def_id) {
|
||||
self.visit_item(item.def.def_id());
|
||||
self.visit_item(item.def);
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, def_id: DefId) {
|
||||
fn visit_item(&mut self, def: Def) {
|
||||
let def_id = def.def_id();
|
||||
let vis = self.cstore.visibility(def_id);
|
||||
let inherited_item_level = if vis == Visibility::Public {
|
||||
self.prev_level
|
||||
|
@ -80,7 +81,7 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> {
|
|||
|
||||
let item_level = self.update(def_id, inherited_item_level);
|
||||
|
||||
if let Some(Def::Mod(_)) = self.cstore.describe_def(def_id) {
|
||||
if let Def::Mod(..) = def {
|
||||
let orig_level = self.prev_level;
|
||||
|
||||
self.prev_level = item_level;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue