fn stability(&self, def: DefId) -> Option<attr::Stability>;
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
fn visibility(&self, def: DefId) -> ty::Visibility;
- fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>>;
+ fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>>;
fn item_generics_cloned(&self, def: DefId) -> ty::Generics;
fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute>;
fn fn_arg_names(&self, did: DefId) -> Vec<ast::Name>;
-> Option<DefId>;
fn def_key(&self, def: DefId) -> DefKey;
fn def_path(&self, def: DefId) -> hir_map::DefPath;
+ fn def_path_hash(&self, def: DefId) -> u64;
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>;
fn item_children(&self, did: DefId) -> Vec<def::Export>;
fn load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro;
fn stability(&self, def: DefId) -> Option<attr::Stability> { bug!("stability") }
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { bug!("deprecation") }
fn visibility(&self, def: DefId) -> ty::Visibility { bug!("visibility") }
- fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
+ fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>> {
bug!("visible_parent_map")
}
fn item_generics_cloned(&self, def: DefId) -> ty::Generics
fn def_path(&self, def: DefId) -> hir_map::DefPath {
bug!("relative_def_path")
}
+ fn def_path_hash(&self, def: DefId) -> u64 {
+ bug!("wa")
+ }
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 load_macro(&self, did: DefId, sess: &Session) -> LoadedMacro { bug!("load_macro") }
predicates => { cdata.get_predicates(def_id.index, tcx) }
super_predicates => { cdata.get_super_predicates(def_id.index, tcx) }
trait_def => {
- tcx.alloc_trait_def(cdata.get_trait_def(def_id.index, tcx))
+ tcx.alloc_trait_def(cdata.get_trait_def(def_id.index))
}
adt_def => { cdata.get_adt_def(def_id.index, tcx) }
adt_destructor => {
self.get_crate_data(def.krate).def_path(def.index)
}
+ fn def_path_hash(&self, def: DefId) -> u64 {
+ self.get_crate_data(def.krate).def_path_hash(def.index)
+ }
+
fn struct_field_names(&self, def: DefId) -> Vec<ast::Name>
{
self.dep_graph.read(DepNode::MetaData(def));
/// Returns a map from a sufficiently visible external item (i.e. an external item that is
/// visible from at least one local module) to a sufficiently visible parent (considering
/// modules that re-export the external item to be parents).
- fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
- let mut visible_parent_map = self.visible_parent_map.borrow_mut();
- if !visible_parent_map.is_empty() { return visible_parent_map; }
+ fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>> {
+ {
+ let visible_parent_map = self.visible_parent_map.borrow();
+ if !visible_parent_map.is_empty() {
+ return visible_parent_map;
+ }
+ }
use std::collections::vec_deque::VecDeque;
use std::collections::hash_map::Entry;
+
+ let mut visible_parent_map = self.visible_parent_map.borrow_mut();
+
for cnum in (1 .. self.next_crate_num().as_usize()).map(CrateNum::new) {
let cdata = self.get_crate_data(cnum);
}
}
- visible_parent_map
+ drop(visible_parent_map);
+ self.visible_parent_map.borrow()
}
}