rustdoc: Fix fallout of removing get()

This commit is contained in:
Alex Crichton 2014-03-20 21:52:59 -07:00
parent 0dbb909bf7
commit 6a7fd8cfa5
2 changed files with 5 additions and 7 deletions

View file

@ -1229,16 +1229,15 @@ fn resolve_type(path: Path, tpbs: Option<Vec<TyParamBound> >,
core::NotTyped(_) => return Bool
};
debug!("searching for {:?} in defmap", id);
let def_map = tycx.def_map.borrow();
let d = match def_map.get().find(&id) {
Some(k) => k,
let d = match tycx.def_map.borrow().find(&id) {
Some(&k) => k,
None => {
debug!("could not find {:?} in defmap (`{}`)", id, tycx.map.node_to_str(id));
fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)")
}
};
let (def_id, kind) = match *d {
let (def_id, kind) = match d {
ast::DefFn(i, _) => (i, TypeFunction),
ast::DefSelfTy(i) => return Self(i),
ast::DefTy(i) => (i, TypeEnum),
@ -1285,8 +1284,7 @@ fn resolve_def(id: ast::NodeId) -> Option<ast::DefId> {
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
match cx.maybe_typed {
core::Typed(ref tcx) => {
let def_map = tcx.def_map.borrow();
def_map.get().find(&id).map(|&d| ast_util::def_id_of_def(d))
tcx.def_map.borrow().find(&id).map(|&d| ast_util::def_id_of_def(d))
}
core::NotTyped(_) => None
}

View file

@ -186,7 +186,7 @@ impl<'a> RustdocVisitor<'a> {
core::Typed(ref tcx) => tcx,
core::NotTyped(_) => return false
};
let def = ast_util::def_id_of_def(*tcx.def_map.borrow().get().get(&id));
let def = ast_util::def_id_of_def(*tcx.def_map.borrow().get(&id));
if !ast_util::is_local(def) { return false }
let analysis = match self.analysis {
Some(analysis) => analysis, None => return false