diff options
| -rw-r--r-- | src/librustc/ich/impls_ty.rs | 5 | ||||
| -rw-r--r-- | src/librustc/infer/error_reporting/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/region.rs | 26 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir/build/scope.rs | 2 |
5 files changed, 19 insertions, 30 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index f9a86c2f010..6d6520adc4e 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -441,9 +441,8 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ::middle::region:: CodeExtentData::DestructionScope(node_id) => { node_id.hash_stable(hcx, hasher); } - CodeExtentData::CallSiteScope { fn_id, body_id } | - CodeExtentData::ParameterScope { fn_id, body_id } => { - fn_id.hash_stable(hcx, hasher); + CodeExtentData::CallSiteScope(body_id) | + CodeExtentData::ParameterScope(body_id) => { body_id.hash_stable(hcx, hasher); } CodeExtentData::Remainder(block_remainder) => { diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index da5ff6ff38a..009dfbd5402 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -153,10 +153,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }; let scope_decorated_tag = match *scope { region::CodeExtentData::Misc(_) => tag, - region::CodeExtentData::CallSiteScope { .. } => { + region::CodeExtentData::CallSiteScope(_) => { "scope of call-site for function" } - region::CodeExtentData::ParameterScope { .. } => { + region::CodeExtentData::ParameterScope(_) => { "scope of function body" } region::CodeExtentData::DestructionScope(_) => { diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 917b21c865a..2940d250dd3 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -107,11 +107,11 @@ pub enum CodeExtentData { // extent of the call-site for a function or closure (outlives // the parameters as well as the body). - CallSiteScope { fn_id: ast::NodeId, body_id: ast::NodeId }, + CallSiteScope(hir::BodyId), // extent of parameters passed to a function or closure (they // outlive its body) - ParameterScope { fn_id: ast::NodeId, body_id: ast::NodeId }, + ParameterScope(hir::BodyId), // extent of destructors for temporaries of node-id DestructionScope(ast::NodeId), @@ -157,8 +157,8 @@ impl CodeExtentData { // precise extent denoted by `self`. CodeExtentData::Remainder(br) => br.block, CodeExtentData::DestructionScope(node_id) => node_id, - CodeExtentData::CallSiteScope { fn_id: _, body_id } | - CodeExtentData::ParameterScope { fn_id: _, body_id } => body_id, + CodeExtentData::CallSiteScope(body_id) | + CodeExtentData::ParameterScope(body_id) => body_id.node_id, } } @@ -169,8 +169,8 @@ impl CodeExtentData { match hir_map.find(self.node_id()) { Some(hir_map::NodeBlock(ref blk)) => { match *self { - CodeExtentData::CallSiteScope { .. } | - CodeExtentData::ParameterScope { .. } | + CodeExtentData::CallSiteScope(_) | + CodeExtentData::ParameterScope(_) | CodeExtentData::Misc(_) | CodeExtentData::DestructionScope(_) => Some(blk.span), @@ -627,10 +627,7 @@ impl<'tcx> RegionMaps<'tcx> { self.root_body.unwrap() }); - tcx.intern_code_extent(CodeExtentData::CallSiteScope { - fn_id: tcx.hir.body_owner(body_id), - body_id: body_id.node_id - }) + tcx.intern_code_extent(CodeExtentData::CallSiteScope(body_id)) } /// Assuming that the provided region was defined within this `RegionMaps`, @@ -651,10 +648,7 @@ impl<'tcx> RegionMaps<'tcx> { let param_owner_id = tcx.hir.as_local_node_id(param_owner).unwrap(); let body_id = tcx.hir.body_owned_by(param_owner_id); - tcx.intern_code_extent(CodeExtentData::CallSiteScope { - fn_id: tcx.hir.body_owner(body_id), - body_id: body_id.node_id - }) + tcx.intern_code_extent(CodeExtentData::CallSiteScope(body_id)) } } @@ -1172,9 +1166,9 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { self.cx.root_id = Some(body_id.node_id); self.cx.parent = Some(self.new_code_extent( - CodeExtentData::CallSiteScope { fn_id: owner_id, body_id: body_id.node_id })); + CodeExtentData::CallSiteScope(body_id))); self.cx.parent = Some(self.new_code_extent( - CodeExtentData::ParameterScope { fn_id: owner_id, body_id: body_id.node_id })); + CodeExtentData::ParameterScope(body_id))); // The arguments and `self` are parented to the fn. self.cx.var_parent = self.cx.parent.take(); diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d69a9b3a8ce..39ab2abcc0e 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -656,17 +656,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn call_site_extent(self, fn_id: ast::NodeId) -> CodeExtent<'gcx> { - self.intern_code_extent(CodeExtentData::CallSiteScope { - fn_id, - body_id: self.hir.body_owned_by(fn_id).node_id - }) + self.intern_code_extent(CodeExtentData::CallSiteScope( + self.hir.body_owned_by(fn_id))) } pub fn parameter_extent(self, fn_id: ast::NodeId) -> CodeExtent<'gcx> { - self.intern_code_extent(CodeExtentData::ParameterScope { - fn_id, - body_id: self.hir.body_owned_by(fn_id).node_id - }) + self.intern_code_extent(CodeExtentData::ParameterScope( + self.hir.body_owned_by(fn_id))) } pub fn intern_code_extent(self, data: CodeExtentData) -> CodeExtent<'gcx> { diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index 6043a696183..56ce4727d5f 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -416,7 +416,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // We want `scopes[1]`, which is the `ParameterScope`. assert!(self.scopes.len() >= 2); assert!(match *self.scopes[1].extent { - CodeExtentData::ParameterScope { .. } => true, + CodeExtentData::ParameterScope(_) => true, _ => false, }); self.scopes[1].extent |
