Skip to content

Commit 4bd2fd5

Browse files
committed
Auto merge of rust-lang#117876 - lcnr:region-kind-rename, r=BoxyUwU
`ReLateBound` -> `ReBound` first step of rust-lang/types-team#95 already fairly large xx there's some future work here I intentionally did not contribute as part of this PR, from my notes: - `DescriptionCtx` to `DescriptionCtxt` - what is `CheckRegions::Bound`? - `collect_late_bound_regions` et al - `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased`? - `EraseEarlyRegions` should be removed, feels duplicate r? `@BoxyUwU`
2 parents 1ab2bcd + 8935a1b commit 4bd2fd5

File tree

93 files changed

+266
-266
lines changed

Some content is hidden

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

93 files changed

+266
-266
lines changed

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir as hir;
1010
use rustc_hir::def::{CtorKind, Namespace};
1111
use rustc_hir::CoroutineKind;
1212
use rustc_index::IndexSlice;
13-
use rustc_infer::infer::LateBoundRegionConversionTime;
13+
use rustc_infer::infer::BoundRegionConversionTime;
1414
use rustc_middle::mir::tcx::PlaceTy;
1515
use rustc_middle::mir::{
1616
AggregateKind, CallSource, ConstOperand, FakeReadCause, Local, LocalInfo, LocalKind, Location,
@@ -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
..
@@ -1113,7 +1113,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11131113
&& let ty::Ref(_, _, hir::Mutability::Mut) = args.type_at(0).kind()
11141114
&& let self_ty = self.infcx.instantiate_binder_with_fresh_vars(
11151115
fn_call_span,
1116-
LateBoundRegionConversionTime::FnCall,
1116+
BoundRegionConversionTime::FnCall,
11171117
tcx.fn_sig(method_did).instantiate(tcx, method_args).input(0),
11181118
)
11191119
&& self.infcx.can_eq(self.param_env, ty, self_ty)

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/renumber.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ pub fn renumber_mir<'tcx>(
2828
renumberer.visit_body(body);
2929
}
3030

31+
// FIXME(@lcnr): A lot of these variants overlap and it seems like
32+
// this type is only used to decide which region should be used
33+
// as representative. This should be cleaned up.
3134
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
3235
pub(crate) enum RegionCtxt {
3336
Location(Location),

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
88
//! contain revealed `impl Trait` values).
99
10-
use rustc_infer::infer::LateBoundRegionConversionTime;
10+
use rustc_infer::infer::BoundRegionConversionTime;
1111
use rustc_middle::mir::*;
1212
use rustc_middle::ty::{self, Ty};
1313
use rustc_span::Span;
@@ -35,7 +35,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
3535
.instantiate_canonical_with_fresh_inference_vars(body.span, &user_provided_poly_sig);
3636
let user_provided_sig = self.infcx.instantiate_binder_with_fresh_vars(
3737
body.span,
38-
LateBoundRegionConversionTime::FnCall,
38+
BoundRegionConversionTime::FnCall,
3939
user_provided_sig,
4040
);
4141

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs;
2121
use rustc_infer::infer::region_constraints::RegionConstraintData;
2222
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
2323
use rustc_infer::infer::{
24-
InferCtxt, LateBoundRegion, LateBoundRegionConversionTime, NllRegionVariableOrigin,
24+
BoundRegion, BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin,
2525
};
2626
use rustc_middle::mir::tcx::PlaceTy;
2727
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
@@ -1401,10 +1401,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14011401
};
14021402

14031403
self.infcx.next_region_var(
1404-
LateBoundRegion(
1404+
BoundRegion(
14051405
term.source_info.span,
14061406
br.kind,
1407-
LateBoundRegionConversionTime::FnCall,
1407+
BoundRegionConversionTime::FnCall,
14081408
),
14091409
region_ctxt_fn,
14101410
)

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
107107
fn next_existential_region_var(
108108
&mut self,
109109
from_forall: bool,
110-
_name: Option<Symbol>,
110+
name: Option<Symbol>,
111111
) -> ty::Region<'tcx> {
112112
let origin = NllRegionVariableOrigin::Existential { from_forall };
113113

114114
let reg_var =
115-
self.type_checker.infcx.next_nll_region_var(origin, || RegionCtxt::Existential(_name));
115+
self.type_checker.infcx.next_nll_region_var(origin, || RegionCtxt::Existential(name));
116116

117117
reg_var
118118
}

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 {

0 commit comments

Comments
 (0)