Skip to content

Commit 4a45578

Browse files
committedDec 7, 2018
Auto merge of rust-lang#56502 - Zoxc:hir-func, r=eddyb
Use a function to access the Hir map to be able to turn it into a query later r? @eddyb

File tree

160 files changed

+1220
-1210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1220
-1210
lines changed
 

‎src/librustc/cfg/construct.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5353
let body_exit;
5454

5555
// Find the tables for this body.
56-
let owner_def_id = tcx.hir.local_def_id(tcx.hir.body_owner(body.id()));
56+
let owner_def_id = tcx.hir().local_def_id(tcx.hir().body_owner(body.id()));
5757
let tables = tcx.typeck_tables_of(owner_def_id);
5858

5959
let mut cfg_builder = CFGBuilder {
@@ -109,7 +109,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
109109
}
110110

111111
fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
112-
let hir_id = self.tcx.hir.node_to_hir_id(stmt.node.id());
112+
let hir_id = self.tcx.hir().node_to_hir_id(stmt.node.id());
113113
match stmt.node {
114114
hir::StmtKind::Decl(ref decl, _) => {
115115
let exit = self.decl(&decl, pred);
@@ -588,9 +588,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
588588
match destination.target_id {
589589
Ok(loop_id) => {
590590
for b in &self.breakable_block_scopes {
591-
if b.block_expr_id == self.tcx.hir.node_to_hir_id(loop_id).local_id {
591+
if b.block_expr_id == self.tcx.hir().node_to_hir_id(loop_id).local_id {
592592
let scope = region::Scope {
593-
id: self.tcx.hir.node_to_hir_id(loop_id).local_id,
593+
id: self.tcx.hir().node_to_hir_id(loop_id).local_id,
594594
data: region::ScopeData::Node
595595
};
596596
return (scope, match scope_cf_kind {
@@ -600,9 +600,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
600600
}
601601
}
602602
for l in &self.loop_scopes {
603-
if l.loop_id == self.tcx.hir.node_to_hir_id(loop_id).local_id {
603+
if l.loop_id == self.tcx.hir().node_to_hir_id(loop_id).local_id {
604604
let scope = region::Scope {
605-
id: self.tcx.hir.node_to_hir_id(loop_id).local_id,
605+
id: self.tcx.hir().node_to_hir_id(loop_id).local_id,
606606
data: region::ScopeData::Node
607607
};
608608
return (scope, match scope_cf_kind {

‎src/librustc/cfg/graphviz.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ pub struct LabelledCFG<'a, 'tcx: 'a> {
3232
impl<'a, 'tcx> LabelledCFG<'a, 'tcx> {
3333
fn local_id_to_string(&self, local_id: hir::ItemLocalId) -> String {
3434
assert!(self.cfg.owner_def_id.is_local());
35-
let node_id = self.tcx.hir.hir_to_node_id(hir::HirId {
36-
owner: self.tcx.hir.def_index_to_hir_id(self.cfg.owner_def_id.index).owner,
35+
let node_id = self.tcx.hir().hir_to_node_id(hir::HirId {
36+
owner: self.tcx.hir().def_index_to_hir_id(self.cfg.owner_def_id.index).owner,
3737
local_id
3838
});
39-
let s = self.tcx.hir.node_to_string(node_id);
39+
let s = self.tcx.hir().node_to_string(node_id);
4040

4141
// Replacing newlines with \\l causes each line to be left-aligned,
4242
// improving presentation of (long) pretty-printed expressions.

0 commit comments

Comments
 (0)
Please sign in to comment.