Introduce TyCtxt::expect_def/expect_resolution helpers and use them where possible

This commit is contained in:
Vadim Petrochenkov
2016-06-03 23:15:00 +03:00
parent 4c30f6405c
commit ee4e55398b
42 changed files with 276 additions and 472 deletions

View File

@@ -50,8 +50,8 @@ pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Name>)
Some(tcx) => tcx,
None => return None,
};
let def = match tcx.def_map.borrow().get(&id) {
Some(d) => d.full_def(),
let def = match tcx.expect_def_or_none(id) {
Some(def) => def,
None => return None,
};
let did = def.def_id();