diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-11-08 10:08:19 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-11-08 10:08:19 +1300 |
| commit | 1328c29d4ae91fe0f932a6036e38374740179213 (patch) | |
| tree | cc89851e65459906f95cac2b7d73cfb5b580166a | |
| parent | 95937990c5e772721e83c603dcca7c5aed8cdd0e (diff) | |
| download | rust-1328c29d4ae91fe0f932a6036e38374740179213.tar.gz rust-1328c29d4ae91fe0f932a6036e38374740179213.zip | |
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
| -rw-r--r-- | src/librustc_save_analysis/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index edb51ae59e1..5d97dbf728b 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -548,7 +548,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } 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)), |
