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>;
|
-> Option<DefIndex>;
|
||||||
fn def_key(&self, def: DefId) -> hir_map::DefKey;
|
fn def_key(&self, def: DefId) -> hir_map::DefKey;
|
||||||
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath>;
|
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 struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
|
||||||
fn item_children(&self, did: DefId) -> Vec<def::Export>;
|
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> {
|
fn relative_def_path(&self, def: DefId) -> Option<hir_map::DefPath> {
|
||||||
bug!("relative_def_path")
|
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 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") }
|
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)
|
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>
|
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>
|
||||||
{
|
{
|
||||||
self.dep_graph.read(DepNode::MetaData(def));
|
self.dep_graph.read(DepNode::MetaData(def));
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::hir::def::CtorKind;
|
|
||||||
use rustc::mir::repr::*;
|
use rustc::mir::repr::*;
|
||||||
use rustc::mir::transform::{MirPass, MirSource, Pass};
|
use rustc::mir::transform::{MirPass, MirSource, Pass};
|
||||||
use rustc_data_structures::indexed_vec::Idx;
|
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!("getting variant {:?}", variant);
|
||||||
debug!("for adt_def {:?}", adt_def);
|
debug!("for adt_def {:?}", adt_def);
|
||||||
let variant_def = &adt_def.variants[variant];
|
return Some(i);
|
||||||
if variant_def.ctor_kind == CtorKind::Fictive {
|
|
||||||
return Some(i);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use syntax::ast::Name;
|
use syntax::ast::Name;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
|
use syntax::parse::token;
|
||||||
|
|
||||||
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind};
|
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind};
|
||||||
use syntax::ast::{Mutability, StmtKind, TraitItem, TraitItemKind};
|
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,
|
fn handle_external_def(ccx: &CrateCtxt,
|
||||||
traits: &mut AllTraitsVec,
|
traits: &mut AllTraitsVec,
|
||||||
external_mods: &mut FnvHashSet<DefId>,
|
external_mods: &mut FnvHashSet<DefId>,
|
||||||
def_id: DefId) {
|
def: Def) {
|
||||||
match ccx.tcx.sess.cstore.describe_def(def_id) {
|
let def_id = def.def_id();
|
||||||
Some(Def::Trait(_)) => {
|
match def {
|
||||||
|
Def::Trait(..) => {
|
||||||
traits.push(TraitInfo::new(def_id));
|
traits.push(TraitInfo::new(def_id));
|
||||||
}
|
}
|
||||||
Some(Def::Mod(_)) => {
|
Def::Mod(..) => {
|
||||||
if !external_mods.insert(def_id) {
|
if !external_mods.insert(def_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for child in ccx.tcx.sess.cstore.item_children(def_id) {
|
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() {
|
for cnum in ccx.tcx.sess.cstore.crates() {
|
||||||
handle_external_def(ccx, &mut traits, &mut external_mods, DefId {
|
let def_id = DefId { krate: cnum, index: CRATE_DEF_INDEX };
|
||||||
krate: cnum,
|
handle_external_def(ccx, &mut traits, &mut external_mods, Def::Mod(def_id));
|
||||||
index: CRATE_DEF_INDEX
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*ccx.all_traits.borrow_mut() = Some(traits);
|
*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) {
|
pub fn visit_mod(&mut self, def_id: DefId) {
|
||||||
for item in self.cstore.item_children(def_id) {
|
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 vis = self.cstore.visibility(def_id);
|
||||||
let inherited_item_level = if vis == Visibility::Public {
|
let inherited_item_level = if vis == Visibility::Public {
|
||||||
self.prev_level
|
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);
|
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;
|
let orig_level = self.prev_level;
|
||||||
|
|
||||||
self.prev_level = item_level;
|
self.prev_level = item_level;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue