Rename to was_placeholder
to from_forall
This commit is contained in:
parent
1caa6dc546
commit
9c5a5c471a
@ -419,7 +419,17 @@ pub enum NLLRegionVariableOrigin {
|
||||
Placeholder(ty::PlaceholderRegion),
|
||||
|
||||
Existential {
|
||||
was_placeholder: bool
|
||||
/// If this is true, then this variable was created to represent a lifetime
|
||||
/// bound in a `for` binder. For example, it might have been created to
|
||||
/// represent the lifetime `'a` in a type like `for<'a> fn(&'a u32)`.
|
||||
/// Such variables are created when we are trying to figure out if there
|
||||
/// is any valid instantiation of `'a` that could fit into some scenario.
|
||||
///
|
||||
/// This is used to inform error reporting: in the case that we are trying to
|
||||
/// determine whether there is any valid instantiation of a `'a` variable that meets
|
||||
/// some constraint C, we want to blame the "source" of that `for` type,
|
||||
/// rather than blaming the source of the constraint C.
|
||||
from_forall: bool
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -159,11 +159,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
|
||||
let should_reverse = match from_region_origin {
|
||||
NLLRegionVariableOrigin::FreeRegion
|
||||
| NLLRegionVariableOrigin::Existential { was_placeholder: false } => {
|
||||
| NLLRegionVariableOrigin::Existential { from_forall: false } => {
|
||||
true
|
||||
}
|
||||
NLLRegionVariableOrigin::Placeholder(_)
|
||||
| NLLRegionVariableOrigin::Existential { was_placeholder: true } => {
|
||||
| NLLRegionVariableOrigin::Existential { from_forall: true } => {
|
||||
false
|
||||
}
|
||||
};
|
||||
|
@ -1612,7 +1612,7 @@ impl<'tcx> RegionDefinition<'tcx> {
|
||||
|
||||
let origin = match rv_origin {
|
||||
RegionVariableOrigin::NLL(origin) => origin,
|
||||
_ => NLLRegionVariableOrigin::Existential { was_placeholder: false },
|
||||
_ => NLLRegionVariableOrigin::Existential { from_forall: false },
|
||||
};
|
||||
|
||||
Self { origin, universe, external_name: None }
|
||||
|
@ -35,7 +35,7 @@ where
|
||||
infcx
|
||||
.tcx
|
||||
.fold_regions(value, &mut false, |_region, _depth| {
|
||||
let origin = NLLRegionVariableOrigin::Existential { was_placeholder: false };
|
||||
let origin = NLLRegionVariableOrigin::Existential { from_forall: false };
|
||||
infcx.next_nll_region_var(origin)
|
||||
})
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||
self.infcx.create_next_universe()
|
||||
}
|
||||
|
||||
fn next_existential_region_var(&mut self, was_placeholder: bool) -> ty::Region<'tcx> {
|
||||
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
|
||||
if let Some(_) = &mut self.borrowck_context {
|
||||
let origin = NLLRegionVariableOrigin::Existential { was_placeholder };
|
||||
let origin = NLLRegionVariableOrigin::Existential { from_forall };
|
||||
self.infcx.next_nll_region_var(origin)
|
||||
} else {
|
||||
self.infcx.tcx.lifetimes.re_erased
|
||||
@ -89,7 +89,7 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
|
||||
self.infcx
|
||||
.next_nll_region_var_in_universe(NLLRegionVariableOrigin::Existential {
|
||||
was_placeholder: false
|
||||
from_forall: false
|
||||
}, universe)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user