Skip to content

Commit b77ab88

Browse files
committed
rename Region constructors
1 parent 3b087b3 commit b77ab88

File tree

10 files changed

+21
-20
lines changed

10 files changed

+21
-20
lines changed

compiler/rustc_borrowck/src/universal_regions.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
783783
let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| {
784784
debug!(?br);
785785
let liberated_region =
786-
ty::Region::new_free(self.tcx, all_outlive_scope.to_def_id(), br.kind);
786+
ty::Region::new_late_param(self.tcx, all_outlive_scope.to_def_id(), br.kind);
787787
let region_vid = {
788788
let name = match br.kind.get_name() {
789789
Some(name) => name,
@@ -932,7 +932,8 @@ fn for_each_late_bound_region_in_item<'tcx>(
932932
let ty::BoundVariableKind::Region(bound_region) = bound_var else {
933933
continue;
934934
};
935-
let liberated_region = ty::Region::new_free(tcx, mir_def_id.to_def_id(), bound_region);
935+
let liberated_region =
936+
ty::Region::new_late_param(tcx, mir_def_id.to_def_id(), bound_region);
936937
f(liberated_region);
937938
}
938939
}

compiler/rustc_hir_analysis/src/astconv/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
258258
let item_def_id = tcx.hir().ty_param_owner(def_id.expect_local());
259259
let generics = tcx.generics_of(item_def_id);
260260
let index = generics.param_def_id_to_index[&def_id];
261-
ty::Region::new_early_bound(
261+
ty::Region::new_early_param(
262262
tcx,
263263
ty::RegionParameterDefinition { def_id, index, name },
264264
)
265265
}
266266

267267
Some(rbv::ResolvedArg::Free(scope, id)) => {
268268
let name = lifetime_name(id.expect_local());
269-
ty::Region::new_free(tcx, scope, ty::BrNamed(id, name))
269+
ty::Region::new_late_param(tcx, scope, ty::BrNamed(id, name))
270270

271271
// (*) -- not late-bound, won't change
272272
}

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RemapLateBound<'_, 'tcx> {
533533

534534
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
535535
if let ty::ReLateParam(fr) = *r {
536-
ty::Region::new_free(
536+
ty::Region::new_late_param(
537537
self.tcx,
538538
fr.scope,
539539
self.mapping.get(&fr.bound_region).copied().unwrap_or(fr.bound_region),
@@ -1119,7 +1119,7 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
11191119
return Err(guar);
11201120
};
11211121

1122-
Ok(ty::Region::new_early_bound(
1122+
Ok(ty::Region::new_early_param(
11231123
self.tcx,
11241124
ty::RegionParameterDefinition {
11251125
def_id: e.def_id,

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
595595
// Same for the region. In our example, 'a corresponds
596596
// to the 'me parameter.
597597
let region_param = gat_generics.param_at(*region_a_idx, tcx);
598-
let region_param = ty::Region::new_early_bound(
598+
let region_param = ty::Region::new_early_param(
599599
tcx,
600600
ty::RegionParameterDefinition {
601601
def_id: region_param.def_id,
@@ -628,7 +628,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
628628
debug!("required clause: {region_a} must outlive {region_b}");
629629
// Translate into the generic parameters of the GAT.
630630
let region_a_param = gat_generics.param_at(*region_a_idx, tcx);
631-
let region_a_param = ty::Region::new_early_bound(
631+
let region_a_param = ty::Region::new_early_param(
632632
tcx,
633633
ty::RegionParameterDefinition {
634634
def_id: region_a_param.def_id,
@@ -638,7 +638,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
638638
);
639639
// Same for the region.
640640
let region_b_param = gat_generics.param_at(*region_b_idx, tcx);
641-
let region_b_param = ty::Region::new_early_bound(
641+
let region_b_param = ty::Region::new_early_param(
642642
tcx,
643643
ty::RegionParameterDefinition {
644644
def_id: region_b_param.def_id,

compiler/rustc_hir_analysis/src/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl<'tcx> AstConv<'tcx> for ItemCtxt<'tcx> {
443443
self.tcx.replace_late_bound_regions_uncached(
444444
poly_trait_ref,
445445
|_| {
446-
ty::Region::new_early_bound(self.tcx, ty::RegionParameterDefinition {
446+
ty::Region::new_early_param(self.tcx, ty::RegionParameterDefinition {
447447
def_id: item_def_id,
448448
index: 0,
449449
name: Symbol::intern(&lt_name),

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn compute_bidirectional_outlives_predicates<'tcx>(
363363
for param in opaque_own_params {
364364
let orig_lifetime = tcx.map_rpit_lifetime_to_fn_lifetime(param.def_id.expect_local());
365365
if let ty::ReEarlyParam(..) = *orig_lifetime {
366-
let dup_lifetime = ty::Region::new_early_bound(
366+
let dup_lifetime = ty::Region::new_early_param(
367367
tcx,
368368
ty::RegionParameterDefinition {
369369
def_id: param.def_id,

compiler/rustc_middle/src/ty/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ impl<'tcx> TyCtxt<'tcx> {
17391739
pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
17401740
match param.kind {
17411741
GenericParamDefKind::Lifetime => {
1742-
ty::Region::new_early_bound(self, param.to_early_bound_region_data()).into()
1742+
ty::Region::new_early_param(self, param.to_early_bound_region_data()).into()
17431743
}
17441744
GenericParamDefKind::Type { .. } => Ty::new_param(self, param.index, param.name).into(),
17451745
GenericParamDefKind::Const { .. } => ty::Const::new_param(
@@ -2075,7 +2075,7 @@ impl<'tcx> TyCtxt<'tcx> {
20752075
}
20762076

20772077
let generics = self.generics_of(new_parent);
2078-
return ty::Region::new_early_bound(
2078+
return ty::Region::new_early_param(
20792079
self,
20802080
ty::RegionParameterDefinition {
20812081
def_id: ebv,
@@ -2088,7 +2088,7 @@ impl<'tcx> TyCtxt<'tcx> {
20882088
}
20892089
Some(resolve_bound_vars::ResolvedArg::LateBound(_, _, lbv)) => {
20902090
let new_parent = self.parent(lbv);
2091-
return ty::Region::new_free(
2091+
return ty::Region::new_late_param(
20922092
self,
20932093
new_parent,
20942094
ty::BoundRegionKind::BrNamed(

compiler/rustc_middle/src/ty/fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<'tcx> TyCtxt<'tcx> {
326326
T: TypeFoldable<TyCtxt<'tcx>>,
327327
{
328328
self.replace_late_bound_regions_uncached(value, |br| {
329-
ty::Region::new_free(self, all_outlive_scope, br.kind)
329+
ty::Region::new_late_param(self, all_outlive_scope, br.kind)
330330
})
331331
}
332332

compiler/rustc_middle/src/ty/sty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ pub struct Region<'tcx>(pub Interned<'tcx, RegionKind<'tcx>>);
14681468

14691469
impl<'tcx> Region<'tcx> {
14701470
#[inline]
1471-
pub fn new_early_bound(
1471+
pub fn new_early_param(
14721472
tcx: TyCtxt<'tcx>,
14731473
early_bound_region: ty::RegionParameterDefinition,
14741474
) -> Region<'tcx> {
@@ -1493,7 +1493,7 @@ impl<'tcx> Region<'tcx> {
14931493
}
14941494

14951495
#[inline]
1496-
pub fn new_free(
1496+
pub fn new_late_param(
14971497
tcx: TyCtxt<'tcx>,
14981498
scope: DefId,
14991499
bound_region: ty::BoundRegionKind,
@@ -1549,10 +1549,10 @@ impl<'tcx> Region<'tcx> {
15491549
/// to avoid the cost of the `match`.
15501550
pub fn new_from_kind(tcx: TyCtxt<'tcx>, kind: RegionKind<'tcx>) -> Region<'tcx> {
15511551
match kind {
1552-
ty::ReEarlyParam(region) => Region::new_early_bound(tcx, region),
1552+
ty::ReEarlyParam(region) => Region::new_early_param(tcx, region),
15531553
ty::ReBound(debruijn, region) => Region::new_bound(tcx, debruijn, region),
15541554
ty::ReLateParam(ty::LateParamRegion { scope, bound_region }) => {
1555-
Region::new_free(tcx, scope, bound_region)
1555+
Region::new_late_param(tcx, scope, bound_region)
15561556
}
15571557
ty::ReStatic => tcx.lifetimes.re_static,
15581558
ty::ReVar(vid) => Region::new_var(tcx, vid),

compiler/rustc_ty_utils/src/implied_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
7575
if matches!(*orig_lt, ty::ReLateParam(..)) {
7676
mapping.insert(
7777
orig_lt,
78-
ty::Region::new_early_bound(
78+
ty::Region::new_early_param(
7979
tcx,
8080
ty::RegionParameterDefinition {
8181
def_id: param.def_id,

0 commit comments

Comments
 (0)