Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2f2b8b3

Browse files
committedSep 3, 2017
Auto merge of #44253 - eddyb:nice-scope, r=nikomatsakis
rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree. r? @nikomatsakis
2 parents 23ade23 + 8bdfd8a commit 2f2b8b3

Some content is hidden

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

65 files changed

+673
-659
lines changed
 

‎src/librustc/cfg/construct.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use rustc_data_structures::graph;
1212
use cfg::*;
13-
use middle::region::CodeExtent;
13+
use middle::region;
1414
use ty::{self, TyCtxt};
1515
use syntax::ptr::P;
1616

@@ -579,14 +579,14 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
579579
fn add_exiting_edge(&mut self,
580580
from_expr: &hir::Expr,
581581
from_index: CFGIndex,
582-
target_scope: CodeExtent,
582+
target_scope: region::Scope,
583583
to_index: CFGIndex) {
584584
let mut data = CFGEdgeData { exiting_scopes: vec![] };
585-
let mut scope = CodeExtent::Misc(from_expr.hir_id.local_id);
586-
let region_maps = self.tcx.region_maps(self.owner_def_id);
585+
let mut scope = region::Scope::Node(from_expr.hir_id.local_id);
586+
let region_scope_tree = self.tcx.region_scope_tree(self.owner_def_id);
587587
while scope != target_scope {
588588
data.exiting_scopes.push(scope.item_local_id());
589-
scope = region_maps.encl_scope(scope);
589+
scope = region_scope_tree.encl_scope(scope);
590590
}
591591
self.graph.add_edge(from_index, to_index, data);
592592
}
@@ -606,14 +606,14 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
606606
fn find_scope_edge(&self,
607607
expr: &hir::Expr,
608608
destination: hir::Destination,
609-
scope_cf_kind: ScopeCfKind) -> (CodeExtent, CFGIndex) {
609+
scope_cf_kind: ScopeCfKind) -> (region::Scope, CFGIndex) {
610610

611611
match destination.target_id {
612612
hir::ScopeTarget::Block(block_expr_id) => {
613613
for b in &self.breakable_block_scopes {
614614
if b.block_expr_id == self.tcx.hir.node_to_hir_id(block_expr_id).local_id {
615615
let scope_id = self.tcx.hir.node_to_hir_id(block_expr_id).local_id;
616-
return (CodeExtent::Misc(scope_id), match scope_cf_kind {
616+
return (region::Scope::Node(scope_id), match scope_cf_kind {
617617
ScopeCfKind::Break => b.break_index,
618618
ScopeCfKind::Continue => bug!("can't continue to block"),
619619
});
@@ -625,7 +625,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
625625
for l in &self.loop_scopes {
626626
if l.loop_id == self.tcx.hir.node_to_hir_id(loop_id).local_id {
627627
let scope_id = self.tcx.hir.node_to_hir_id(loop_id).local_id;
628-
return (CodeExtent::Misc(scope_id), match scope_cf_kind {
628+
return (region::Scope::Node(scope_id), match scope_cf_kind {
629629
ScopeCfKind::Break => l.break_index,
630630
ScopeCfKind::Continue => l.continue_index,
631631
});

‎src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ define_dep_nodes!( <'tcx>
395395
[] WorkProduct(WorkProductId),
396396

397397
// Represents different phases in the compiler.
398-
[] RegionMaps(DefId),
398+
[] RegionScopeTree(DefId),
399399
[] Coherence,
400400
[] CoherenceInherentImplOverlapCheck,
401401
[] Resolve,

0 commit comments

Comments
 (0)