diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-08-31 21:37:38 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2017-09-01 23:27:48 +0300 |
| commit | 8bdfd8a0036d3594efd9c90a328afa41a1ba359d (patch) | |
| tree | dad9d89248dfae3927b2dff4884f13281b3046e9 /src/librustc_mir/build/expr | |
| parent | f861b6ee46465097eec266c160ac53e230df7cf0 (diff) | |
| download | rust-8bdfd8a0036d3594efd9c90a328afa41a1ba359d.tar.gz rust-8bdfd8a0036d3594efd9c90a328afa41a1ba359d.zip | |
rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree.
Diffstat (limited to 'src/librustc_mir/build/expr')
| -rw-r--r-- | src/librustc_mir/build/expr/as_constant.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/as_lvalue.rs | 8 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/as_operand.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/as_rvalue.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/as_temp.rs | 10 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/into.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/build/expr/stmt.rs | 22 |
7 files changed, 38 insertions, 34 deletions
diff --git a/src/librustc_mir/build/expr/as_constant.rs b/src/librustc_mir/build/expr/as_constant.rs index 6d15f0a2e5d..a86b7f4d239 100644 --- a/src/librustc_mir/build/expr/as_constant.rs +++ b/src/librustc_mir/build/expr/as_constant.rs @@ -29,7 +29,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let Expr { ty, temp_lifetime: _, span, kind } = expr; match kind { - ExprKind::Scope { extent: _, value } => + ExprKind::Scope { region_scope: _, value } => this.as_constant(value), ExprKind::Literal { literal } => Constant { span: span, ty: ty, literal: literal }, diff --git a/src/librustc_mir/build/expr/as_lvalue.rs b/src/librustc_mir/build/expr/as_lvalue.rs index 72eeaca8b10..01b76af1576 100644 --- a/src/librustc_mir/build/expr/as_lvalue.rs +++ b/src/librustc_mir/build/expr/as_lvalue.rs @@ -39,8 +39,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let expr_span = expr.span; let source_info = this.source_info(expr_span); match expr.kind { - ExprKind::Scope { extent, value } => { - this.in_scope((extent, source_info), block, |this| this.as_lvalue(block, value)) + ExprKind::Scope { region_scope, value } => { + this.in_scope((region_scope, source_info), block, |this| { + this.as_lvalue(block, value) + }) } ExprKind::Field { lhs, name } => { let lvalue = unpack!(block = this.as_lvalue(block, lhs)); @@ -56,7 +58,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let (usize_ty, bool_ty) = (this.hir.usize_ty(), this.hir.bool_ty()); let slice = unpack!(block = this.as_lvalue(block, lhs)); - // extent=None so lvalue indexes live forever. They are scalars so they + // region_scope=None so lvalue indexes live forever. They are scalars so they // do not need storage annotations, and they are often copied between // places. let idx = unpack!(block = this.as_operand(block, None, index)); diff --git a/src/librustc_mir/build/expr/as_operand.rs b/src/librustc_mir/build/expr/as_operand.rs index 4679e0bb0a5..ea1b53add5e 100644 --- a/src/librustc_mir/build/expr/as_operand.rs +++ b/src/librustc_mir/build/expr/as_operand.rs @@ -13,7 +13,7 @@ use build::{BlockAnd, BlockAndExtension, Builder}; use build::expr::category::Category; use hair::*; -use rustc::middle::region::CodeExtent; +use rustc::middle::region; use rustc::mir::*; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { @@ -39,7 +39,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// The operand is known to be live until the end of `scope`. pub fn as_operand<M>(&mut self, block: BasicBlock, - scope: Option<CodeExtent>, + scope: Option<region::Scope>, expr: M) -> BlockAnd<Operand<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>> { @@ -49,16 +49,16 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn expr_as_operand(&mut self, mut block: BasicBlock, - scope: Option<CodeExtent>, + scope: Option<region::Scope>, expr: Expr<'tcx>) -> BlockAnd<Operand<'tcx>> { debug!("expr_as_operand(block={:?}, expr={:?})", block, expr); let this = self; - if let ExprKind::Scope { extent, value } = expr.kind { + if let ExprKind::Scope { region_scope, value } = expr.kind { let source_info = this.source_info(expr.span); - let extent = (extent, source_info); - return this.in_scope(extent, block, |this| { + let region_scope = (region_scope, source_info); + return this.in_scope(region_scope, block, |this| { this.as_operand(block, scope, value) }); } diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index da375e791bc..7591200b13f 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -21,7 +21,7 @@ use build::expr::category::{Category, RvalueFunc}; use hair::*; use rustc_const_math::{ConstInt, ConstIsize}; use rustc::middle::const_val::ConstVal; -use rustc::middle::region::CodeExtent; +use rustc::middle::region; use rustc::ty; use rustc::mir::*; use syntax::ast; @@ -38,7 +38,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } /// Compile `expr`, yielding an rvalue. - pub fn as_rvalue<M>(&mut self, block: BasicBlock, scope: Option<CodeExtent>, expr: M) + pub fn as_rvalue<M>(&mut self, block: BasicBlock, scope: Option<region::Scope>, expr: M) -> BlockAnd<Rvalue<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>> { @@ -48,7 +48,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn expr_as_rvalue(&mut self, mut block: BasicBlock, - scope: Option<CodeExtent>, + scope: Option<region::Scope>, expr: Expr<'tcx>) -> BlockAnd<Rvalue<'tcx>> { debug!("expr_as_rvalue(block={:?}, scope={:?}, expr={:?})", block, scope, expr); @@ -58,9 +58,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let source_info = this.source_info(expr_span); match expr.kind { - ExprKind::Scope { extent, value } => { - let extent = (extent, source_info); - this.in_scope(extent, block, |this| this.as_rvalue(block, scope, value)) + ExprKind::Scope { region_scope, value } => { + let region_scope = (region_scope, source_info); + this.in_scope(region_scope, block, |this| this.as_rvalue(block, scope, value)) } ExprKind::Repeat { value, count } => { let value_operand = unpack!(block = this.as_operand(block, scope, value)); diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index 4f248ddb0e2..1b63db9017d 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -13,7 +13,7 @@ use build::{BlockAnd, BlockAndExtension, Builder}; use build::expr::category::Category; use hair::*; -use rustc::middle::region::CodeExtent; +use rustc::middle::region; use rustc::mir::*; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { @@ -21,7 +21,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// up rvalues so as to freeze the value that will be consumed. pub fn as_temp<M>(&mut self, block: BasicBlock, - temp_lifetime: Option<CodeExtent>, + temp_lifetime: Option<region::Scope>, expr: M) -> BlockAnd<Lvalue<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>> @@ -32,7 +32,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn expr_as_temp(&mut self, mut block: BasicBlock, - temp_lifetime: Option<CodeExtent>, + temp_lifetime: Option<region::Scope>, expr: Expr<'tcx>) -> BlockAnd<Lvalue<'tcx>> { debug!("expr_as_temp(block={:?}, temp_lifetime={:?}, expr={:?})", @@ -41,8 +41,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let expr_span = expr.span; let source_info = this.source_info(expr_span); - if let ExprKind::Scope { extent, value } = expr.kind { - return this.in_scope((extent, source_info), block, |this| { + if let ExprKind::Scope { region_scope, value } = expr.kind { + return this.in_scope((region_scope, source_info), block, |this| { this.as_temp(block, temp_lifetime, value) }); } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index f8db2c82082..6d7c2132665 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -38,9 +38,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let source_info = this.source_info(expr_span); match expr.kind { - ExprKind::Scope { extent, value } => { - let extent = (extent, source_info); - this.in_scope(extent, block, |this| this.into(destination, block, value)) + ExprKind::Scope { region_scope, value } => { + let region_scope = (region_scope, source_info); + this.in_scope(region_scope, block, |this| this.into(destination, block, value)) } ExprKind::Block { body: ast_block } => { this.ast_block(destination, block, ast_block, source_info) diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index 0da722f72a1..84468d5d6dc 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -22,9 +22,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // Handle a number of expressions that don't need a destination at all. This // avoids needing a mountain of temporary `()` variables. match expr.kind { - ExprKind::Scope { extent, value } => { + ExprKind::Scope { region_scope, value } => { let value = this.hir.mirror(value); - this.in_scope((extent, source_info), block, |this| this.stmt_expr(block, value)) + this.in_scope((region_scope, source_info), block, |this| { + this.stmt_expr(block, value) + }) } ExprKind::Assign { lhs, rhs } => { let lhs = this.hir.mirror(lhs); @@ -77,29 +79,29 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block.unit() } ExprKind::Continue { label } => { - let BreakableScope { continue_block, extent, .. } = + let BreakableScope { continue_block, region_scope, .. } = *this.find_breakable_scope(expr_span, label); let continue_block = continue_block.expect( "Attempted to continue in non-continuable breakable block"); - this.exit_scope(expr_span, (extent, source_info), block, continue_block); + this.exit_scope(expr_span, (region_scope, source_info), block, continue_block); this.cfg.start_new_block().unit() } ExprKind::Break { label, value } => { - let (break_block, extent, destination) = { + let (break_block, region_scope, destination) = { let BreakableScope { break_block, - extent, + region_scope, ref break_destination, .. } = *this.find_breakable_scope(expr_span, label); - (break_block, extent, break_destination.clone()) + (break_block, region_scope, break_destination.clone()) }; if let Some(value) = value { unpack!(block = this.into(&destination, block, value)) } else { this.cfg.push_assign_unit(block, source_info, &destination) } - this.exit_scope(expr_span, (extent, source_info), block, break_block); + this.exit_scope(expr_span, (region_scope, source_info), block, break_block); this.cfg.start_new_block().unit() } ExprKind::Return { value } => { @@ -114,9 +116,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block } }; - let extent = this.extent_of_return_scope(); + let region_scope = this.region_scope_of_return_scope(); let return_block = this.return_block(); - this.exit_scope(expr_span, (extent, source_info), block, return_block); + this.exit_scope(expr_span, (region_scope, source_info), block, return_block); this.cfg.start_new_block().unit() } ExprKind::InlineAsm { asm, outputs, inputs } => { |
