rename ReLateBound
to ReBound
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
This commit is contained in:
parent
28328c8389
commit
86fa1317a3
80 changed files with 192 additions and 195 deletions
|
@ -73,8 +73,11 @@ impl<'a> DescriptionCtx<'a> {
|
|||
// ReFree rather than dumping Debug output on the user.
|
||||
//
|
||||
// We shouldn't really be having unification failures with ReVar
|
||||
// and ReLateBound though.
|
||||
ty::ReVar(_) | ty::ReLateBound(..) | ty::ReErased => {
|
||||
// and ReBound though.
|
||||
//
|
||||
// FIXME(@lcnr): figure out why we `ReBound` have to handle `ReBound`
|
||||
// here, this feels somewhat off.
|
||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => {
|
||||
(alt_span, "revar", format!("{region:?}"))
|
||||
}
|
||||
};
|
||||
|
|
|
@ -232,7 +232,7 @@ impl CanonicalizeMode for CanonicalizeUserTypeAnnotation {
|
|||
match *r {
|
||||
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReErased | ty::ReStatic | ty::ReError(_) => r,
|
||||
ty::ReVar(_) => canonicalizer.canonical_var_for_region_in_root_universe(r),
|
||||
ty::RePlaceholder(..) | ty::ReLateBound(..) => {
|
||||
ty::RePlaceholder(..) | ty::ReBound(..) => {
|
||||
// We only expect region names that the user can type.
|
||||
bug!("unexpected region in query response: `{:?}`", r)
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
|
|||
|
||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||
match *r {
|
||||
ty::ReLateBound(index, ..) => {
|
||||
ty::ReBound(index, ..) => {
|
||||
if index >= self.binder_index {
|
||||
bug!("escaping late-bound region during canonicalization");
|
||||
} else {
|
||||
|
@ -776,7 +776,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
|||
) -> ty::Region<'tcx> {
|
||||
let var = self.canonical_var(info, r.into());
|
||||
let br = ty::BoundRegion { var, kind: ty::BrAnon };
|
||||
ty::Region::new_late_bound(self.interner(), self.binder_index, br)
|
||||
ty::Region::new_bound(self.interner(), self.binder_index, br)
|
||||
}
|
||||
|
||||
/// Given a type variable `ty_var` of the given kind, first check
|
||||
|
|
|
@ -460,7 +460,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
}
|
||||
GenericArgKind::Lifetime(result_value) => {
|
||||
// e.g., here `result_value` might be `'?1` in the example above...
|
||||
if let ty::ReLateBound(debruijn, br) = *result_value {
|
||||
if let ty::ReBound(debruijn, br) = *result_value {
|
||||
// ... in which case we would set `canonical_vars[0]` to `Some('static)`.
|
||||
|
||||
// We only allow a `ty::INNERMOST` index in substitutions.
|
||||
|
|
|
@ -175,10 +175,10 @@ pub(super) fn note_and_explain_region<'tcx>(
|
|||
ty::ReError(_) => return,
|
||||
|
||||
// We shouldn't really be having unification failures with ReVar
|
||||
// and ReLateBound though.
|
||||
ty::ReVar(_) | ty::ReLateBound(..) | ty::ReErased => {
|
||||
(format!("lifetime `{region}`"), alt_span)
|
||||
}
|
||||
// and ReBound though.
|
||||
//
|
||||
// FIXME(@lcnr): Figure out whether this is reachable and if so, why.
|
||||
ty::ReVar(_) | ty::ReBound(..) | ty::ReErased => (format!("lifetime `{region}`"), alt_span),
|
||||
};
|
||||
|
||||
emit_msg_span(err, prefix, description, span, suffix);
|
||||
|
@ -1285,7 +1285,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
if lifetimes.0 != lifetimes.1 {
|
||||
values.0.push_highlighted(l1);
|
||||
values.1.push_highlighted(l2);
|
||||
} else if lifetimes.0.is_late_bound() {
|
||||
} else if lifetimes.0.is_bound() {
|
||||
values.0.push_normal(l1);
|
||||
values.1.push_normal(l2);
|
||||
} else {
|
||||
|
|
|
@ -572,8 +572,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
if let ty::Ref(expected_region, _, _) = expected.kind()
|
||||
&& let ty::Ref(found_region, _, _) = found.kind()
|
||||
&& expected_region.is_late_bound()
|
||||
&& !found_region.is_late_bound()
|
||||
&& expected_region.is_bound()
|
||||
&& !found_region.is_bound()
|
||||
&& let hir::TyKind::Infer = arg_hir.kind
|
||||
{
|
||||
// If the expected region is late bound, the found region is not, and users are asking compiler
|
||||
|
|
|
@ -110,7 +110,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
|
|||
|
||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||
match *r {
|
||||
ty::ReLateBound(..) => {
|
||||
ty::ReBound(..) => {
|
||||
// leave bound regions alone
|
||||
r
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ where
|
|||
match *r {
|
||||
// Never make variables for regions bound within the type itself,
|
||||
// nor for erased regions.
|
||||
ty::ReLateBound(..) | ty::ReErased => {
|
||||
ty::ReBound(..) | ty::ReErased => {
|
||||
return Ok(r);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_index::{IndexSlice, IndexVec};
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{ReBound, RePlaceholder, ReVar};
|
||||
use rustc_middle::ty::{ReEarlyBound, ReErased, ReError, ReFree, ReStatic};
|
||||
use rustc_middle::ty::{ReLateBound, RePlaceholder, ReVar};
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
use rustc_span::Span;
|
||||
use std::fmt;
|
||||
|
@ -378,7 +378,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
// so it doesn't really matter if it's shorter or longer than an empty region
|
||||
ReError(_) => false,
|
||||
|
||||
ReLateBound(..) | ReErased => {
|
||||
ReBound(..) | ReErased => {
|
||||
bug!("cannot relate region: {:?}", a);
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
// so it doesn't really matter if it's shorter or longer than an empty region
|
||||
ReError(_) => false,
|
||||
|
||||
ReLateBound(..) | ReErased => {
|
||||
ReBound(..) | ReErased => {
|
||||
bug!("cannot relate region: {:?}", b);
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
#[instrument(level = "trace", skip(self), ret)]
|
||||
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
|
||||
match (*a, *b) {
|
||||
(ReLateBound(..), _) | (_, ReLateBound(..)) | (ReErased, _) | (_, ReErased) => {
|
||||
(ReBound(..), _) | (_, ReBound(..)) | (ReErased, _) | (_, ReErased) => {
|
||||
bug!("cannot relate region: LUB({:?}, {:?})", a, b);
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ where
|
|||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match *r {
|
||||
// ignore bound regions, keep visiting
|
||||
ty::ReLateBound(_, _) => ControlFlow::Continue(()),
|
||||
ty::ReBound(_, _) => ControlFlow::Continue(()),
|
||||
_ => {
|
||||
(self.op)(r);
|
||||
ControlFlow::Continue(())
|
||||
|
|
|
@ -213,8 +213,8 @@ pub(super) fn compute_alias_components_recursive<'tcx>(
|
|||
compute_components(tcx, ty, out, visited);
|
||||
}
|
||||
GenericArgKind::Lifetime(lt) => {
|
||||
// Ignore late-bound regions.
|
||||
if !lt.is_late_bound() {
|
||||
// Ignore higher ranked regions.
|
||||
if !lt.is_bound() {
|
||||
out.push(Component::Region(lt));
|
||||
}
|
||||
}
|
||||
|
@ -241,8 +241,8 @@ fn compute_components_recursive<'tcx>(
|
|||
compute_components(tcx, ty, out, visited);
|
||||
}
|
||||
GenericArgKind::Lifetime(lt) => {
|
||||
// Ignore late-bound regions.
|
||||
if !lt.is_late_bound() {
|
||||
// Ignore higher ranked regions.
|
||||
if !lt.is_bound() {
|
||||
out.push(Component::Region(lt));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ where
|
|||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match *r {
|
||||
// ignore bound regions, keep visiting
|
||||
ty::ReLateBound(_, _) => ControlFlow::Continue(()),
|
||||
ty::ReBound(_, _) => ControlFlow::Continue(()),
|
||||
_ => {
|
||||
(self.op)(r);
|
||||
ControlFlow::Continue(())
|
||||
|
|
|
@ -48,7 +48,7 @@ pub fn extract_verify_if_eq<'tcx>(
|
|||
let verify_if_eq = verify_if_eq_b.skip_binder();
|
||||
m.relate(verify_if_eq.ty, test_ty).ok()?;
|
||||
|
||||
if let ty::RegionKind::ReLateBound(depth, br) = verify_if_eq.bound.kind() {
|
||||
if let ty::RegionKind::ReBound(depth, br) = verify_if_eq.bound.kind() {
|
||||
assert!(depth == ty::INNERMOST);
|
||||
match m.map.get(&br) {
|
||||
Some(&r) => Some(r),
|
||||
|
@ -177,7 +177,7 @@ impl<'tcx> TypeRelation<'tcx> for MatchAgainstHigherRankedOutlives<'tcx> {
|
|||
value: ty::Region<'tcx>,
|
||||
) -> RelateResult<'tcx, ty::Region<'tcx>> {
|
||||
debug!("self.pattern_depth = {:?}", self.pattern_depth);
|
||||
if let ty::RegionKind::ReLateBound(depth, br) = pattern.kind()
|
||||
if let ty::RegionKind::ReBound(depth, br) = pattern.kind()
|
||||
&& depth == self.pattern_depth
|
||||
{
|
||||
self.bind(br, value)
|
||||
|
|
|
@ -16,7 +16,7 @@ use rustc_index::IndexVec;
|
|||
use rustc_middle::infer::unify_key::{RegionVidKey, UnifiedRegion};
|
||||
use rustc_middle::ty::ReStatic;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{ReLateBound, ReVar};
|
||||
use rustc_middle::ty::{ReBound, ReVar};
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -531,7 +531,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
debug!("origin = {:#?}", origin);
|
||||
|
||||
match (*sub, *sup) {
|
||||
(ReLateBound(..), _) | (_, ReLateBound(..)) => {
|
||||
(ReBound(..), _) | (_, ReBound(..)) => {
|
||||
span_bug!(origin.span(), "cannot relate bound region: {:?} <= {:?}", sub, sup);
|
||||
}
|
||||
(_, ReStatic) => {
|
||||
|
@ -667,7 +667,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
| ty::ReError(_) => ty::UniverseIndex::ROOT,
|
||||
ty::RePlaceholder(placeholder) => placeholder.universe,
|
||||
ty::ReVar(vid) => self.var_universe(vid),
|
||||
ty::ReLateBound(..) => bug!("universe(): encountered bound region {:?}", region),
|
||||
ty::ReBound(..) => bug!("universe(): encountered bound region {:?}", region),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
|
|||
// consider this as evidence that `T: 'static`, but
|
||||
// I'm a bit wary of such constructions and so for now
|
||||
// I want to be conservative. --nmatsakis
|
||||
if r_min.is_late_bound() {
|
||||
if r_min.is_bound() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
|
|||
.into_iter()
|
||||
.filter_map(|component| match component {
|
||||
Component::Region(r) => {
|
||||
if r.is_late_bound() {
|
||||
if r.is_bound() {
|
||||
None
|
||||
} else {
|
||||
Some(ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue