-> 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>;
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") }
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));
// 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;
}
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);
- }
+ return Some(i);
};
None
}
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};
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);
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
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;