Skip to content

Commit

Permalink
save-analysis: fix a bug with tuple sub-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Jun 17, 2016
1 parent a835d74 commit 60e19ce
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -1297,7 +1298,14 @@ impl<'v, 'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'v> for DumpVisitor<'l, 'tcx,
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, _) => {
Expand Down

0 comments on commit 60e19ce

Please sign in to comment.