提交 1328c29d 编写于 作者: N Nick Cameron

save-analysis: fix bug with method ids

This just handles a missing entry, doesn't try to recover, because I couldn't actually find a test case.

cc https://github.com/rust-lang-nursery/rls/issues/558
上级 95937990
......@@ -548,7 +548,13 @@ pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
}
ast::ExprKind::MethodCall(ref seg, ..) => {
let expr_hir_id = self.tcx.hir.definitions().node_to_hir_id(expr.id);
let method_id = self.tables.type_dependent_defs()[expr_hir_id].def_id();
let method_id = match self.tables.type_dependent_defs().get(expr_hir_id) {
Some(id) => id.def_id(),
None => {
debug!("Could not resolve method id for {:?}", expr);
return None;
}
};
let (def_id, decl_id) = match self.tcx.associated_item(method_id).container {
ty::ImplContainer(_) => (Some(method_id), None),
ty::TraitContainer(_) => (None, Some(method_id)),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册