Skip to content

Commit 6e5a325

Browse files
committed
Auto merge of #28484 - nrc:fix-save, r=alexcrichton
Should be lowering ast expressions to HIR expressions, not cheating via the hir map. That goes wrong now that there is not a 1:1 mapping between ast and hir (in the case of the crash due to ExprParen).
2 parents fb5de8c + 66f662f commit 6e5a325

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_trans/save/dump_csv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
10971097

10981098
self.visit_expr(&**sub_ex);
10991099

1100-
let hir_node = self.tcx.map.expect_expr(sub_ex.id);
1100+
let hir_node = lower_expr(sub_ex);
11011101
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
11021102
match *ty {
11031103
ty::TyStruct(def, _) => {

src/librustc_trans/save/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::path::{Path, PathBuf};
1818

1919
use rustc_front;
2020
use rustc::front::map::NodeItem;
21-
use rustc_front::hir;
21+
use rustc_front::{hir, lowering};
2222

2323
use syntax::attr;
2424
use syntax::ast::{self, NodeId};
@@ -442,7 +442,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
442442
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
443443
match expr.node {
444444
ast::ExprField(ref sub_ex, ident) => {
445-
let hir_node = self.tcx.map.expect_expr(sub_ex.id);
445+
let hir_node = lowering::lower_expr(sub_ex);
446446
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
447447
match *ty {
448448
ty::TyStruct(def, _) => {
@@ -462,8 +462,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
462462
}
463463
}
464464
ast::ExprStruct(ref path, _, _) => {
465-
let hir_node = self.tcx.map.expect_expr(expr.id);
466-
let ty = &self.tcx.expr_ty_adjusted(hir_node).sty;
465+
let hir_node = lowering::lower_expr(expr);
466+
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
467467
match *ty {
468468
ty::TyStruct(def, _) => {
469469
let sub_span = self.span_utils.span_for_last_ident(path.span);

0 commit comments

Comments
 (0)