diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-07-06 19:13:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-06 19:13:06 -0400 |
| commit | affbbc3e450f76bfd40c3d9d7a2f3fb5982ef2a8 (patch) | |
| tree | c9331dc15a617026152195a5195775c0b954fd5b /src | |
| parent | 62bae0ad42e9245ba0583adcfc368833d24c5c51 (diff) | |
| parent | 60e19ce9e60ae054d1c468d1a4385bad3fbb8f63 (diff) | |
| download | rust-affbbc3e450f76bfd40c3d9d7a2f3fb5982ef2a8.tar.gz rust-affbbc3e450f76bfd40c3d9d7a2f3fb5982ef2a8.zip | |
Rollup merge of #34327 - nrc:save-fix-tuple, r=jseyfried
save-analysis: fix a bug with tuple sub-expressions
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index c1960eeee46..4ffb5477305 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -29,6 +29,7 @@ use rustc::hir::def::Def; use rustc::hir::def_id::DefId; +use rustc::hir::map::Node; use rustc::session::Session; use rustc::ty::{self, TyCtxt, ImplOrTraitItem, ImplOrTraitItemContainer}; @@ -1299,7 +1300,14 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D> ast::ExprKind::TupField(ref sub_ex, idx) => { self.visit_expr(&sub_ex); - let hir_node = self.save_ctxt.tcx.map.expect_expr(sub_ex.id); + let hir_node = match self.save_ctxt.tcx.map.find(sub_ex.id) { + Some(Node::NodeExpr(expr)) => expr, + _ => { + debug!("Missing or weird node for sub-expression {} in {:?}", + sub_ex.id, ex); + return; + } + }; let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty; match *ty { ty::TyStruct(def, _) => { |
