Remove ReEmpty
This commit is contained in:
parent
dd0335a27f
commit
1ca9eb8ec3
27 changed files with 64 additions and 256 deletions
|
@ -27,13 +27,6 @@ impl<'a> DescriptionCtx<'a> {
|
|||
me.kind = "restatic";
|
||||
}
|
||||
|
||||
ty::ReEmpty(ty::UniverseIndex::ROOT) => me.kind = "reempty",
|
||||
|
||||
ty::ReEmpty(ui) => {
|
||||
me.kind = "reemptyuni";
|
||||
me.arg = format!("{:?}", ui);
|
||||
}
|
||||
|
||||
ty::RePlaceholder(_) => return None,
|
||||
|
||||
// FIXME(#13998) RePlaceholder should probably print like
|
||||
|
|
|
@ -180,11 +180,7 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
|
|||
r: ty::Region<'tcx>,
|
||||
) -> ty::Region<'tcx> {
|
||||
match *r {
|
||||
ty::ReFree(_)
|
||||
| ty::ReErased
|
||||
| ty::ReStatic
|
||||
| ty::ReEmpty(ty::UniverseIndex::ROOT)
|
||||
| ty::ReEarlyBound(..) => r,
|
||||
ty::ReFree(_) | ty::ReErased | ty::ReStatic | ty::ReEarlyBound(..) => r,
|
||||
|
||||
ty::RePlaceholder(placeholder) => canonicalizer.canonical_var_for_region(
|
||||
CanonicalVarInfo { kind: CanonicalVarKind::PlaceholderRegion(placeholder) },
|
||||
|
@ -199,10 +195,6 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
|
|||
)
|
||||
}
|
||||
|
||||
ty::ReEmpty(ui) => {
|
||||
bug!("canonicalizing 'empty in universe {:?}", ui) // FIXME
|
||||
}
|
||||
|
||||
_ => {
|
||||
// Other than `'static` or `'empty`, the query
|
||||
// response should be executing in a fully
|
||||
|
@ -381,7 +373,6 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
|
|||
ty::ReStatic
|
||||
| ty::ReEarlyBound(..)
|
||||
| ty::ReFree(_)
|
||||
| ty::ReEmpty(_)
|
||||
| ty::RePlaceholder(..)
|
||||
| ty::ReErased => self.canonicalize_mode.canonicalize_free_region(self, r),
|
||||
}
|
||||
|
|
|
@ -688,7 +688,6 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
|||
|
||||
ty::RePlaceholder(..)
|
||||
| ty::ReVar(..)
|
||||
| ty::ReEmpty(_)
|
||||
| ty::ReStatic
|
||||
| ty::ReEarlyBound(..)
|
||||
| ty::ReFree(..) => {
|
||||
|
@ -900,7 +899,6 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||
|
||||
ty::RePlaceholder(..)
|
||||
| ty::ReVar(..)
|
||||
| ty::ReEmpty(_)
|
||||
| ty::ReStatic
|
||||
| ty::ReEarlyBound(..)
|
||||
| ty::ReFree(..) => {
|
||||
|
|
|
@ -96,11 +96,6 @@ pub(super) fn note_and_explain_region<'tcx>(
|
|||
msg_span_from_free_region(tcx, region, alt_span)
|
||||
}
|
||||
|
||||
ty::ReEmpty(ty::UniverseIndex::ROOT) => ("the empty lifetime".to_owned(), alt_span),
|
||||
|
||||
// uh oh, hope no user ever sees THIS
|
||||
ty::ReEmpty(ui) => (format!("the empty lifetime in universe {:?}", ui), alt_span),
|
||||
|
||||
ty::RePlaceholder(_) => return,
|
||||
|
||||
// FIXME(#13998) RePlaceholder should probably print like
|
||||
|
@ -139,8 +134,6 @@ fn msg_span_from_free_region<'tcx>(
|
|||
(msg, Some(span))
|
||||
}
|
||||
ty::ReStatic => ("the static lifetime".to_owned(), alt_span),
|
||||
ty::ReEmpty(ty::UniverseIndex::ROOT) => ("an empty lifetime".to_owned(), alt_span),
|
||||
ty::ReEmpty(ui) => (format!("an empty lifetime in universe {:?}", ui), alt_span),
|
||||
_ => bug!("{:?}", region),
|
||||
}
|
||||
}
|
||||
|
@ -250,17 +243,7 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
|
|||
|
||||
// Explain the region we are capturing.
|
||||
match *hidden_region {
|
||||
ty::ReEmpty(ty::UniverseIndex::ROOT) => {
|
||||
// All lifetimes shorter than the function body are `empty` in
|
||||
// lexical region resolution. The default explanation of "an empty
|
||||
// lifetime" isn't really accurate here.
|
||||
let message = format!(
|
||||
"hidden type `{}` captures lifetime smaller than the function body",
|
||||
hidden_ty
|
||||
);
|
||||
err.span_note(span, &message);
|
||||
}
|
||||
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReStatic | ty::ReEmpty(_) => {
|
||||
ty::ReEarlyBound(_) | ty::ReFree(_) | ty::ReStatic => {
|
||||
// Assuming regionck succeeded (*), we ought to always be
|
||||
// capturing *some* region from the fn header, and hence it
|
||||
// ought to be free. So under normal circumstances, we will go
|
||||
|
|
|
@ -126,7 +126,6 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
|
|||
| ty::ReFree(_)
|
||||
| ty::ReVar(_)
|
||||
| ty::RePlaceholder(..)
|
||||
| ty::ReEmpty(_)
|
||||
| ty::ReErased => {
|
||||
// replace all free regions with 'erased
|
||||
self.tcx().lifetimes.re_erased
|
||||
|
|
|
@ -16,7 +16,7 @@ use rustc_data_structures::intern::Interned;
|
|||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{ReEarlyBound, ReEmpty, ReErased, ReFree, ReStatic};
|
||||
use rustc_middle::ty::{ReEarlyBound, ReErased, ReFree, ReStatic};
|
||||
use rustc_middle::ty::{ReLateBound, RePlaceholder, ReVar};
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
use rustc_span::Span;
|
||||
|
@ -261,13 +261,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
cur_region
|
||||
}
|
||||
|
||||
ReEmpty(b_ui) => {
|
||||
// Empty regions are ordered according to the universe
|
||||
// they are associated with.
|
||||
let ui = a_universe.min(b_ui);
|
||||
self.tcx().mk_region(ReEmpty(ui))
|
||||
}
|
||||
|
||||
RePlaceholder(placeholder) => {
|
||||
// If the empty and placeholder regions are in the same universe,
|
||||
// then the LUB is the Placeholder region (which is the cur_region).
|
||||
|
@ -399,13 +392,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
a_region
|
||||
}
|
||||
|
||||
ReEmpty(a_ui) => {
|
||||
// Empty regions are ordered according to the universe
|
||||
// they are associated with.
|
||||
let ui = a_ui.min(empty_ui);
|
||||
self.tcx().mk_region(ReEmpty(ui))
|
||||
}
|
||||
|
||||
RePlaceholder(placeholder) => {
|
||||
// If this empty region is from a universe that can
|
||||
// name the placeholder, then the placeholder is
|
||||
|
@ -428,9 +414,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
// check below for a common case, here purely as an
|
||||
// optimization.
|
||||
let b_universe = self.var_infos[b_vid].universe;
|
||||
if let ReEmpty(a_universe) = *a_region && a_universe == b_universe {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut lub = self.lub_concrete_regions(a_region, cur_region);
|
||||
if lub == cur_region {
|
||||
|
@ -470,7 +453,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
// they are associated with.
|
||||
a_ui.min(b_ui) == b_ui
|
||||
}
|
||||
(VarValue::Value(a), VarValue::Empty(b_ui)) => {
|
||||
(VarValue::Value(a), VarValue::Empty(_)) => {
|
||||
match *a {
|
||||
ReLateBound(..) | ReErased => {
|
||||
bug!("cannot relate region: {:?}", a);
|
||||
|
@ -493,12 +476,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
false
|
||||
}
|
||||
|
||||
ReEmpty(a_ui) => {
|
||||
// Empty regions are ordered according to the universe
|
||||
// they are associated with.
|
||||
a_ui.min(b_ui) == b_ui
|
||||
}
|
||||
|
||||
RePlaceholder(_) => {
|
||||
// The LUB is either `a` or `'static`
|
||||
false
|
||||
|
@ -526,12 +503,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
true
|
||||
}
|
||||
|
||||
ReEmpty(b_ui) => {
|
||||
// Empty regions are ordered according to the universe
|
||||
// they are associated with.
|
||||
a_ui.min(b_ui) == b_ui
|
||||
}
|
||||
|
||||
RePlaceholder(placeholder) => {
|
||||
// If this empty region is from a universe that can
|
||||
// name the placeholder, then the placeholder is
|
||||
|
@ -599,37 +570,6 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
self.tcx().lifetimes.re_static
|
||||
}
|
||||
|
||||
(ReEmpty(_), ReEarlyBound(_) | ReFree(_)) => {
|
||||
// All empty regions are less than early-bound, free,
|
||||
// and scope regions.
|
||||
b
|
||||
}
|
||||
|
||||
(ReEarlyBound(_) | ReFree(_), ReEmpty(_)) => {
|
||||
// All empty regions are less than early-bound, free,
|
||||
// and scope regions.
|
||||
a
|
||||
}
|
||||
|
||||
(ReEmpty(a_ui), ReEmpty(b_ui)) => {
|
||||
// Empty regions are ordered according to the universe
|
||||
// they are associated with.
|
||||
let ui = a_ui.min(b_ui);
|
||||
self.tcx().mk_region(ReEmpty(ui))
|
||||
}
|
||||
|
||||
(ReEmpty(empty_ui), RePlaceholder(placeholder))
|
||||
| (RePlaceholder(placeholder), ReEmpty(empty_ui)) => {
|
||||
// If this empty region is from a universe that can
|
||||
// name the placeholder, then the placeholder is
|
||||
// larger; otherwise, the only ancestor is `'static`.
|
||||
if empty_ui.can_name(placeholder.universe) {
|
||||
self.tcx().mk_region(RePlaceholder(placeholder))
|
||||
} else {
|
||||
self.tcx().lifetimes.re_static
|
||||
}
|
||||
}
|
||||
|
||||
(ReEarlyBound(_) | ReFree(_), ReEarlyBound(_) | ReFree(_)) => {
|
||||
self.region_rels.lub_free_regions(a, b)
|
||||
}
|
||||
|
@ -1088,9 +1028,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||
ty::ReVar(rid) => match var_values.values[rid] {
|
||||
VarValue::ErrorValue => false,
|
||||
VarValue::Empty(_) => true,
|
||||
VarValue::Value(min) => matches!(*min, ty::ReEmpty(_)),
|
||||
VarValue::Value(_) => false,
|
||||
},
|
||||
_ => matches!(*min, ty::ReEmpty(_)),
|
||||
_ => false,
|
||||
},
|
||||
|
||||
VerifyBound::AnyBound(bs) => {
|
||||
|
|
|
@ -699,7 +699,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
ty::ReStatic | ty::ReErased | ty::ReFree(..) | ty::ReEarlyBound(..) => {
|
||||
ty::UniverseIndex::ROOT
|
||||
}
|
||||
ty::ReEmpty(ui) => ui,
|
||||
ty::RePlaceholder(placeholder) => placeholder.universe,
|
||||
ty::ReVar(vid) => self.var_universe(vid),
|
||||
ty::ReLateBound(..) => bug!("universe(): encountered bound region {:?}", region),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue