1
Fork 0

Change to ReError(ErrorGuaranteed)

This commit is contained in:
Esteban Küber 2023-02-07 14:55:16 +00:00
parent ffaf2a5c27
commit 861f451235
23 changed files with 70 additions and 61 deletions

View file

@ -31,7 +31,7 @@ impl<'a> DescriptionCtx<'a> {
ty::RePlaceholder(_) => return None,
ty::ReError => return None,
ty::ReError(_) => return None,
// FIXME(#13998) RePlaceholder should probably print like
// ReFree rather than dumping Debug output on the user.

View file

@ -371,7 +371,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
ty::ReStatic
| ty::ReEarlyBound(..)
| ty::ReError
| ty::ReError(_)
| ty::ReFree(_)
| ty::RePlaceholder(..)
| ty::ReErased => self.canonicalize_mode.canonicalize_free_region(self, r),

View file

@ -705,7 +705,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
return Ok(r);
}
ty::ReError => {
ty::ReError(_) => {
return Ok(r);
}
@ -865,7 +865,7 @@ impl<'tcx> FallibleTypeFolder<'tcx> for ConstInferUnifier<'_, 'tcx> {
match *r {
// Never make variables for regions bound within the type itself,
// nor for erased regions.
ty::ReLateBound(..) | ty::ReErased | ty::ReError => {
ty::ReLateBound(..) | ty::ReErased | ty::ReError(_) => {
return Ok(r);
}

View file

@ -134,7 +134,7 @@ pub(super) fn note_and_explain_region<'tcx>(
ty::RePlaceholder(_) => return,
ty::ReError => return,
ty::ReError(_) => return,
// FIXME(#13998) RePlaceholder should probably print like
// ReFree rather than dumping Debug output on the user.
@ -315,7 +315,7 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
)
}
}
ty::ReError => {
ty::ReError(_) => {
err.delay_as_bug();
}
_ => {

View file

@ -126,7 +126,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
| ty::ReFree(_)
| ty::ReVar(_)
| ty::RePlaceholder(..)
| ty::ReError
| ty::ReError(_)
| ty::ReErased => {
// replace all free regions with 'erased
self.tcx().lifetimes.re_erased

View file

@ -216,7 +216,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
Ok(self.tcx().lifetimes.re_static)
}
ReError => Ok(self.tcx().lifetimes.re_error),
ReError(_) => Ok(self.tcx().re_error()),
ReEarlyBound(_) | ReFree(_) => {
// All empty regions are less than early-bound, free,
@ -438,7 +438,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
}
(VarValue::Value(a), VarValue::Empty(_)) => {
match *a {
ReLateBound(..) | ReErased | ReError => {
ReLateBound(..) | ReErased | ReError(_) => {
bug!("cannot relate region: {:?}", a);
}
@ -467,7 +467,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
}
(VarValue::Empty(a_ui), VarValue::Value(b)) => {
match *b {
ReLateBound(..) | ReErased | ReError => {
ReLateBound(..) | ReErased | ReError(_) => {
bug!("cannot relate region: {:?}", b);
}
@ -548,7 +548,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
);
}
(ReError, _) | (_, ReError) => self.tcx().lifetimes.re_error,
(ReError(_), _) | (_, ReError(_)) => self.tcx().re_error(),
(ReStatic, _) | (_, ReStatic) => {
// nothing lives longer than `'static`
@ -1044,7 +1044,7 @@ impl<'tcx> LexicalRegionResolutions<'tcx> {
ty::ReVar(rid) => match self.values[rid] {
VarValue::Empty(_) => r,
VarValue::Value(r) => r,
VarValue::ErrorValue => tcx.lifetimes.re_error,
VarValue::ErrorValue => tcx.re_error(),
},
_ => r,
};

View file

@ -696,9 +696,11 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
pub fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex {
match *region {
ty::ReStatic | ty::ReErased | ty::ReFree(..) | ty::ReEarlyBound(..) | ty::ReError => {
ty::UniverseIndex::ROOT
}
ty::ReStatic
| ty::ReErased
| ty::ReFree(..)
| ty::ReEarlyBound(..)
| 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),