Skip to content
12 changes: 6 additions & 6 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let body_exit;

// Find the tables for this body.
let owner_def_id = tcx.hir().local_def_id(tcx.hir().body_owner(body.id()));
let owner_def_id = tcx.hir().local_def_id_from_hir_id(tcx.hir().body_owner(body.id()));
let tables = tcx.typeck_tables_of(owner_def_id);

let mut cfg_builder = CFGBuilder {
Expand Down Expand Up @@ -99,15 +99,15 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
}

fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
let hir_id = self.tcx.hir().node_to_hir_id(stmt.node.id());
let hir_id = stmt.node.hir_id();
match stmt.node {
hir::StmtKind::Decl(ref decl, _) => {
hir::StmtKind::Decl(ref decl, ..) => {
let exit = self.decl(&decl, pred);
self.add_ast_node(hir_id.local_id, &[exit])
}

hir::StmtKind::Expr(ref expr, _) |
hir::StmtKind::Semi(ref expr, _) => {
hir::StmtKind::Expr(ref expr, ..) |
hir::StmtKind::Semi(ref expr, ..) => {
let exit = self.expr(&expr, pred);
self.add_ast_node(hir_id.local_id, &[exit])
}
Expand Down Expand Up @@ -406,7 +406,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
args: I) -> CFGIndex {
let func_or_rcvr_exit = self.expr(func_or_rcvr, pred);
let ret = self.straightline(call_expr, func_or_rcvr_exit, args);
let m = self.tcx.hir().get_module_parent(call_expr.id);
let m = self.tcx.hir().get_module_parent(call_expr.hir_id);
if self.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(call_expr)) {
self.add_unreachable_node()
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
/// Check any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
if target == Target::Fn || target == Target::Const {
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.id));
let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id);
self.tcx.codegen_fn_attrs(def_id);
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) {
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
.span_label(item.span, "not a function")
Expand Down Expand Up @@ -283,7 +284,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {

fn check_stmt_attributes(&self, stmt: &hir::Stmt) {
// When checking statements ignore expressions, they will be checked later
if let hir::StmtKind::Decl(_, _) = stmt.node {
if let hir::StmtKind::Decl(_, ..) = stmt.node {
for attr in stmt.node.attrs() {
if attr.check_name("inline") {
self.check_inline(attr, &stmt.span, Target::Statement);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ pub enum Def {
Method(DefId),
AssociatedConst(DefId),

Local(ast::NodeId),
Upvar(ast::NodeId, // `NodeId` of closed over local
usize, // index in the `freevars` list of the closure
ast::NodeId), // expr node that creates the closure
Local(hir::HirId),
Upvar(hir::HirId, // `HirId` of closed over local
usize, // index in the `freevars` list of the closure
hir::HirId), // expr node that creates the closure
Label(ast::NodeId),

// Macro namespace
Expand Down
Loading