Skip to content

Commit 86fa131

Browse files
committed
rename ReLateBound to ReBound
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
1 parent 28328c8 commit 86fa131

File tree

80 files changed

+192
-195
lines changed

Some content is hidden

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

80 files changed

+192
-195
lines changed

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
462462
// lifetimes without names with the value `'0`.
463463
if let ty::Ref(region, ..) = ty.kind() {
464464
match **region {
465-
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
465+
ty::ReBound(_, ty::BoundRegion { kind: br, .. })
466466
| ty::RePlaceholder(ty::PlaceholderRegion {
467467
bound: ty::BoundRegion { kind: br, .. },
468468
..
@@ -482,7 +482,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
482482

483483
let region = if let ty::Ref(region, ..) = ty.kind() {
484484
match **region {
485-
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
485+
ty::ReBound(_, ty::BoundRegion { kind: br, .. })
486486
| ty::RePlaceholder(ty::PlaceholderRegion {
487487
bound: ty::BoundRegion { kind: br, .. },
488488
..

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
357357
ty::BoundRegionKind::BrAnon => None,
358358
},
359359

360-
ty::ReLateBound(..)
360+
ty::ReBound(..)
361361
| ty::ReVar(..)
362362
| ty::RePlaceholder(..)
363363
| ty::ReErased

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
665665
var: ty::BoundVar::from_usize(bound_vars.len() - 1),
666666
kind: ty::BrEnv,
667667
};
668-
let env_region = ty::Region::new_late_bound(tcx, ty::INNERMOST, br);
668+
let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, br);
669669
let closure_ty = tcx.closure_env_ty(def_id, args, env_region).unwrap();
670670

671671
// The "inputs" of the closure in the

compiler/rustc_hir_analysis/src/astconv/bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
350350
let args =
351351
candidate.skip_binder().args.extend_to(tcx, assoc_item.def_id, |param, _| {
352352
let subst = match param.kind {
353-
ty::GenericParamDefKind::Lifetime => ty::Region::new_late_bound(
353+
ty::GenericParamDefKind::Lifetime => ty::Region::new_bound(
354354
tcx,
355355
ty::INNERMOST,
356356
ty::BoundRegion {

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
250250
var: ty::BoundVar::from_u32(index),
251251
kind: ty::BrNamed(def_id, name),
252252
};
253-
ty::Region::new_late_bound(tcx, debruijn, br)
253+
ty::Region::new_bound(tcx, debruijn, br)
254254
}
255255

256256
Some(rbv::ResolvedArg::EarlyBound(def_id)) => {
@@ -1622,7 +1622,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16221622
}
16231623

16241624
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
1625-
if r.is_late_bound() { self.tcx.lifetimes.re_erased } else { r }
1625+
// FIXME(@lcnr): This is broken, erasing bound regions
1626+
// impacts selection as it results in different types.
1627+
if r.is_bound() { self.tcx.lifetimes.re_erased } else { r }
16261628
}
16271629

16281630
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,7 @@ fn param_env_with_gat_bounds<'tcx>(
23452345
let kind = ty::BoundRegionKind::BrNamed(param.def_id, param.name);
23462346
let bound_var = ty::BoundVariableKind::Region(kind);
23472347
bound_vars.push(bound_var);
2348-
ty::Region::new_late_bound(
2348+
ty::Region::new_bound(
23492349
tcx,
23502350
ty::INNERMOST,
23512351
ty::BoundRegion {

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
143143
]);
144144
let mk_va_list_ty = |mutbl| {
145145
tcx.lang_items().va_list().map(|did| {
146-
let region = ty::Region::new_late_bound(
146+
let region = ty::Region::new_bound(
147147
tcx,
148148
ty::INNERMOST,
149149
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon },
150150
);
151-
let env_region = ty::Region::new_late_bound(
151+
let env_region = ty::Region::new_bound(
152152
tcx,
153153
ty::INNERMOST,
154154
ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrEnv },
@@ -411,7 +411,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
411411
1,
412412
vec![Ty::new_imm_ref(
413413
tcx,
414-
ty::Region::new_late_bound(tcx, ty::INNERMOST, br),
414+
ty::Region::new_bound(tcx, ty::INNERMOST, br),
415415
param(0),
416416
)],
417417
Ty::new_projection(tcx, discriminant_def_id, tcx.mk_args(&[param(0).into()])),
@@ -465,11 +465,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
465465

466466
sym::raw_eq => {
467467
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon };
468-
let param_ty = Ty::new_imm_ref(
469-
tcx,
470-
ty::Region::new_late_bound(tcx, ty::INNERMOST, br),
471-
param(0),
472-
);
468+
let param_ty =
469+
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
473470
(1, vec![param_ty; 2], tcx.types.bool)
474471
}
475472

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GATSubstCollector<'tcx> {
763763
ty::Alias(ty::Projection, p) if p.def_id == self.gat => {
764764
for (idx, subst) in p.args.iter().enumerate() {
765765
match subst.unpack() {
766-
GenericArgKind::Lifetime(lt) if !lt.is_late_bound() => {
766+
GenericArgKind::Lifetime(lt) if !lt.is_bound() => {
767767
self.regions.insert((lt, idx));
768768
}
769769
GenericArgKind::Type(t) => {

compiler/rustc_hir_analysis/src/hir_wf_check.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for EraseAllBoundRegions<'tcx> {
196196
self.tcx
197197
}
198198
fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx> {
199-
if r.is_late_bound() { self.tcx.lifetimes.re_erased } else { r }
199+
// FIXME(@lcnr): only erase escaping bound regions!
200+
if r.is_bound() { self.tcx.lifetimes.re_erased } else { r }
200201
}
201202
}

compiler/rustc_hir_analysis/src/outlives/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ fn is_free_region(region: Region<'_>) -> bool {
167167
// }
168168
//
169169
// The type above might generate a `T: 'b` bound, but we can
170-
// ignore it. We can't put it on the struct header anyway.
171-
ty::ReLateBound(..) => false,
170+
// ignore it. We can't name this lifetime pn the struct header anyway.
171+
ty::ReBound(..) => false,
172172

173173
ty::ReError(_) => false,
174174

0 commit comments

Comments
 (0)