Skip to content

Commit affbbc3

Browse files
authored
Rollup merge of rust-lang#34327 - nrc:save-fix-tuple, r=jseyfried
save-analysis: fix a bug with tuple sub-expressions
2 parents 62bae0a + 60e19ce commit affbbc3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
3030
use rustc::hir::def::Def;
3131
use rustc::hir::def_id::DefId;
32+
use rustc::hir::map::Node;
3233
use rustc::session::Session;
3334
use rustc::ty::{self, TyCtxt, ImplOrTraitItem, ImplOrTraitItemContainer};
3435

@@ -1299,7 +1300,14 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
12991300
ast::ExprKind::TupField(ref sub_ex, idx) => {
13001301
self.visit_expr(&sub_ex);
13011302

1302-
let hir_node = self.save_ctxt.tcx.map.expect_expr(sub_ex.id);
1303+
let hir_node = match self.save_ctxt.tcx.map.find(sub_ex.id) {
1304+
Some(Node::NodeExpr(expr)) => expr,
1305+
_ => {
1306+
debug!("Missing or weird node for sub-expression {} in {:?}",
1307+
sub_ex.id, ex);
1308+
return;
1309+
}
1310+
};
13031311
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
13041312
match *ty {
13051313
ty::TyStruct(def, _) => {

0 commit comments

Comments
 (0)