Skip to content

Commit b95e875

Browse files
committed
Add ids to several region_maps calls
1 parent 3508874 commit b95e875

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

src/librustc/infer/region_inference/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
938938
// A "free" region can be interpreted as "some region
939939
// at least as big as the block fr.scope_id". So, we can
940940
// reasonably compare free regions and scopes:
941-
let r_id = self.tcx.region_maps().nearest_common_ancestor(fr.scope, s_id);
941+
let r_id = self.tcx.region_maps()
942+
.nearest_common_ancestor(fr.scope, s_id);
942943

943944
if r_id == fr.scope {
944945
// if the free region's scope `fr.scope_id` is bigger than

src/librustc/middle/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
14411441
// and must outlive the *call-site* of the function.
14421442
let fn_ret =
14431443
self.ir.tcx.liberate_late_bound_regions(
1444-
self.ir.tcx.region_maps().call_site_extent(id, body.value.id),
1444+
self.ir.tcx.region_maps(id).call_site_extent(id, body.value.id),
14451445
&fn_ret);
14461446

14471447
if !fn_ret.is_never() && self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() {

src/librustc/middle/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
793793
// The environment of a closure is guaranteed to
794794
// outlive any bindings introduced in the body of the
795795
// closure itself.
796-
scope: self.tcx().region_maps().item_extent(fn_body_id),
796+
scope: self.tcx().region_maps(fn_body_id).item_extent(fn_body_id),
797797
bound_region: ty::BrEnv
798798
}));
799799

@@ -842,7 +842,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
842842
pub fn temporary_scope(&self, id: ast::NodeId) -> (&'tcx ty::Region, &'tcx ty::Region)
843843
{
844844
let (scope, old_scope) =
845-
self.tcx().region_maps().old_and_new_temporary_scope(id);
845+
self.tcx().region_maps(id).old_and_new_temporary_scope(id);
846846
(self.tcx().mk_region(match scope {
847847
Some(scope) => ty::ReScope(scope),
848848
None => ty::ReStatic

src/librustc/traits/object_safety.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
198198

199199
// Search for a predicate like `Self : Sized` amongst the trait bounds.
200200
let free_substs = self.construct_free_substs(def_id,
201-
self.region_maps().node_extent(ast::DUMMY_NODE_ID));
201+
self.region_maps(self.hir.as_local_node_id(def_id).unwrap())
202+
.node_extent(ast::DUMMY_NODE_ID));
202203
let predicates = self.item_predicates(def_id);
203204
let predicates = predicates.instantiate(self, free_substs).predicates;
204205
elaborate_predicates(self, predicates)

src/librustc/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
666666
pub fn region_maps(self, node_id: NodeId) -> Rc<RegionMaps> {
667667
// Find the `NodeId` of the outermost function that wraps the node pointed to by node_id
668668
let mut outermost_fn_id_opt = None;
669-
let mut outermost_id = fn_id;
669+
let mut outermost_id = node_id;
670670
loop {
671671
if self.hir.is_fn(outermost_id) {
672672
outermost_fn_id_opt = Some(outermost_id);

src/librustc/ty/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -1212,13 +1212,14 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12121212
let impl_def_id = tcx.hir.local_def_id(impl_id);
12131213
tcx.construct_parameter_environment(impl_item.span,
12141214
impl_def_id,
1215-
tcx.region_maps().item_extent(id))
1215+
tcx.region_maps(impl_id)
1216+
.item_extent(id))
12161217
}
12171218
hir::ImplItemKind::Method(_, ref body) => {
12181219
tcx.construct_parameter_environment(
12191220
impl_item.span,
12201221
tcx.hir.local_def_id(id),
1221-
tcx.region_maps().call_site_extent(id, body.node_id))
1222+
tcx.region_maps(id).call_site_extent(id, body.node_id))
12221223
}
12231224
}
12241225
}
@@ -1231,18 +1232,19 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12311232
let trait_def_id = tcx.hir.local_def_id(trait_id);
12321233
tcx.construct_parameter_environment(trait_item.span,
12331234
trait_def_id,
1234-
tcx.region_maps().item_extent(id))
1235+
tcx.region_maps(id).item_extent(id))
12351236
}
12361237
hir::TraitItemKind::Method(_, ref body) => {
12371238
// Use call-site for extent (unless this is a
12381239
// trait method with no default; then fallback
12391240
// to the method id).
12401241
let extent = if let hir::TraitMethod::Provided(body_id) = *body {
12411242
// default impl: use call_site extent as free_id_outlive bound.
1242-
tcx.region_maps().call_site_extent(id, body_id.node_id)
1243+
tcx.region_maps(body_id.node_id)
1244+
.call_site_extent(id, body_id.node_id)
12431245
} else {
12441246
// no default impl: use item extent as free_id_outlive bound.
1245-
tcx.region_maps().item_extent(id)
1247+
tcx.region_maps(id).item_extent(id)
12461248
};
12471249
tcx.construct_parameter_environment(
12481250
trait_item.span,
@@ -1260,7 +1262,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12601262
tcx.construct_parameter_environment(
12611263
item.span,
12621264
fn_def_id,
1263-
tcx.region_maps().call_site_extent(id, body_id.node_id))
1265+
tcx.region_maps(body_id.node_id).call_site_extent(id, body_id.node_id))
12641266
}
12651267
hir::ItemEnum(..) |
12661268
hir::ItemStruct(..) |
@@ -1272,13 +1274,13 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12721274
let def_id = tcx.hir.local_def_id(id);
12731275
tcx.construct_parameter_environment(item.span,
12741276
def_id,
1275-
tcx.region_maps().item_extent(id))
1277+
tcx.region_maps(id).item_extent(id))
12761278
}
12771279
hir::ItemTrait(..) => {
12781280
let def_id = tcx.hir.local_def_id(id);
12791281
tcx.construct_parameter_environment(item.span,
12801282
def_id,
1281-
tcx.region_maps().item_extent(id))
1283+
tcx.region_maps(id).item_extent(id))
12821284
}
12831285
_ => {
12841286
span_bug!(item.span,
@@ -1296,7 +1298,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12961298
tcx.construct_parameter_environment(
12971299
expr.span,
12981300
base_def_id,
1299-
tcx.region_maps().call_site_extent(id, body.node_id))
1301+
tcx.region_maps(body.node_id).call_site_extent(id, body.node_id))
13001302
} else {
13011303
tcx.empty_parameter_environment()
13021304
}
@@ -2560,7 +2562,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25602562
}
25612563

25622564
pub fn node_scope_region(self, id: NodeId) -> &'tcx Region {
2563-
self.mk_region(ty::ReScope(self.region_maps().node_extent(id)))
2565+
self.mk_region(ty::ReScope(self.region_maps(id).node_extent(id)))
25642566
}
25652567

25662568
pub fn visit_all_item_likes_in_krate<V,F>(self,

0 commit comments

Comments
 (0)