Rename NLL* to Nll* accordingly to C-CASE
This commit is contained in:
parent
e32f372c42
commit
f8e0e78d75
11 changed files with 71 additions and 71 deletions
|
@ -14,7 +14,7 @@ use crate::infer::canonical::{
|
||||||
};
|
};
|
||||||
use crate::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
|
use crate::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
|
||||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||||
use crate::infer::{InferCtxt, InferOk, InferResult, NLLRegionVariableOrigin};
|
use crate::infer::{InferCtxt, InferOk, InferResult, NllRegionVariableOrigin};
|
||||||
use crate::traits::query::{Fallible, NoSolution};
|
use crate::traits::query::{Fallible, NoSolution};
|
||||||
use crate::traits::TraitEngine;
|
use crate::traits::TraitEngine;
|
||||||
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
use crate::traits::{Obligation, ObligationCause, PredicateObligation};
|
||||||
|
@ -644,7 +644,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
|
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
|
||||||
let origin = NLLRegionVariableOrigin::Existential { from_forall };
|
let origin = NllRegionVariableOrigin::Existential { from_forall };
|
||||||
self.infcx.next_nll_region_var(origin)
|
self.infcx.next_nll_region_var(origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
||||||
|
|
||||||
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
|
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
|
||||||
self.infcx.next_nll_region_var_in_universe(
|
self.infcx.next_nll_region_var_in_universe(
|
||||||
NLLRegionVariableOrigin::Existential { from_forall: false },
|
NllRegionVariableOrigin::Existential { from_forall: false },
|
||||||
universe,
|
universe,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2342,7 +2342,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
|
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
|
||||||
format!(" for capture of `{}` by closure", var_name)
|
format!(" for capture of `{}` by closure", var_name)
|
||||||
}
|
}
|
||||||
infer::NLL(..) => bug!("NLL variable found in lexical phase"),
|
infer::Nll(..) => bug!("NLL variable found in lexical phase"),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
|
|
|
@ -458,11 +458,11 @@ pub enum RegionVariableOrigin {
|
||||||
|
|
||||||
/// This origin is used for the inference variables that we create
|
/// This origin is used for the inference variables that we create
|
||||||
/// during NLL region processing.
|
/// during NLL region processing.
|
||||||
NLL(NLLRegionVariableOrigin),
|
Nll(NllRegionVariableOrigin),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum NLLRegionVariableOrigin {
|
pub enum NllRegionVariableOrigin {
|
||||||
/// During NLL region processing, we create variables for free
|
/// During NLL region processing, we create variables for free
|
||||||
/// regions that we encounter in the function signature and
|
/// regions that we encounter in the function signature and
|
||||||
/// elsewhere. This origin indices we've got one of those.
|
/// elsewhere. This origin indices we've got one of those.
|
||||||
|
@ -1078,17 +1078,17 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just a convenient wrapper of `next_region_var` for using during NLL.
|
/// Just a convenient wrapper of `next_region_var` for using during NLL.
|
||||||
pub fn next_nll_region_var(&self, origin: NLLRegionVariableOrigin) -> ty::Region<'tcx> {
|
pub fn next_nll_region_var(&self, origin: NllRegionVariableOrigin) -> ty::Region<'tcx> {
|
||||||
self.next_region_var(RegionVariableOrigin::NLL(origin))
|
self.next_region_var(RegionVariableOrigin::Nll(origin))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just a convenient wrapper of `next_region_var` for using during NLL.
|
/// Just a convenient wrapper of `next_region_var` for using during NLL.
|
||||||
pub fn next_nll_region_var_in_universe(
|
pub fn next_nll_region_var_in_universe(
|
||||||
&self,
|
&self,
|
||||||
origin: NLLRegionVariableOrigin,
|
origin: NllRegionVariableOrigin,
|
||||||
universe: ty::UniverseIndex,
|
universe: ty::UniverseIndex,
|
||||||
) -> ty::Region<'tcx> {
|
) -> ty::Region<'tcx> {
|
||||||
self.next_region_var_in_universe(RegionVariableOrigin::NLL(origin), universe)
|
self.next_region_var_in_universe(RegionVariableOrigin::Nll(origin), universe)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
|
pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
|
||||||
|
@ -1770,7 +1770,7 @@ impl RegionVariableOrigin {
|
||||||
| LateBoundRegion(a, ..)
|
| LateBoundRegion(a, ..)
|
||||||
| UpvarRegion(_, a) => a,
|
| UpvarRegion(_, a) => a,
|
||||||
BoundRegionInCoherence(_) => rustc_span::DUMMY_SP,
|
BoundRegionInCoherence(_) => rustc_span::DUMMY_SP,
|
||||||
NLL(..) => bug!("NLL variable used with `span`"),
|
Nll(..) => bug!("NLL variable used with `span`"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::collections::VecDeque;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_infer::infer::NLLRegionVariableOrigin;
|
use rustc_infer::infer::NllRegionVariableOrigin;
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
Body, CastKind, ConstraintCategory, FakeReadCause, Local, Location, Operand, Place, Rvalue,
|
Body, CastKind, ConstraintCategory, FakeReadCause, Local, Location, Operand, Place, Rvalue,
|
||||||
Statement, StatementKind, TerminatorKind,
|
Statement, StatementKind, TerminatorKind,
|
||||||
|
@ -258,7 +258,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let (category, from_closure, span) = self.regioncx.best_blame_constraint(
|
let (category, from_closure, span) = self.regioncx.best_blame_constraint(
|
||||||
&self.body,
|
&self.body,
|
||||||
borrow_region,
|
borrow_region,
|
||||||
NLLRegionVariableOrigin::FreeRegion,
|
NllRegionVariableOrigin::FreeRegion,
|
||||||
|r| self.regioncx.provides_universal_region(r, borrow_region, outlived_region),
|
|r| self.regioncx.provides_universal_region(r, borrow_region, outlived_region),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use rustc_errors::{Applicability, DiagnosticBuilder};
|
use rustc_errors::{Applicability, DiagnosticBuilder};
|
||||||
use rustc_infer::infer::{
|
use rustc_infer::infer::{
|
||||||
error_reporting::nice_region_error::NiceRegionError,
|
error_reporting::nice_region_error::NiceRegionError,
|
||||||
error_reporting::unexpected_hidden_region_diagnostic, NLLRegionVariableOrigin,
|
error_reporting::unexpected_hidden_region_diagnostic, NllRegionVariableOrigin,
|
||||||
};
|
};
|
||||||
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
|
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
|
||||||
use rustc_middle::ty::subst::Subst;
|
use rustc_middle::ty::subst::Subst;
|
||||||
|
@ -75,13 +75,13 @@ crate enum RegionErrorKind<'tcx> {
|
||||||
/// The region element that erroneously must be outlived by `longer_fr`.
|
/// The region element that erroneously must be outlived by `longer_fr`.
|
||||||
error_element: RegionElement,
|
error_element: RegionElement,
|
||||||
/// The origin of the placeholder region.
|
/// The origin of the placeholder region.
|
||||||
fr_origin: NLLRegionVariableOrigin,
|
fr_origin: NllRegionVariableOrigin,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Any other lifetime error.
|
/// Any other lifetime error.
|
||||||
RegionError {
|
RegionError {
|
||||||
/// The origin of the region.
|
/// The origin of the region.
|
||||||
fr_origin: NLLRegionVariableOrigin,
|
fr_origin: NllRegionVariableOrigin,
|
||||||
/// The region that should outlive `shorter_fr`.
|
/// The region that should outlive `shorter_fr`.
|
||||||
longer_fr: RegionVid,
|
longer_fr: RegionVid,
|
||||||
/// The region that should be shorter, but we can't prove it.
|
/// The region that should be shorter, but we can't prove it.
|
||||||
|
@ -269,7 +269,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
pub(in crate::borrow_check) fn report_region_error(
|
pub(in crate::borrow_check) fn report_region_error(
|
||||||
&mut self,
|
&mut self,
|
||||||
fr: RegionVid,
|
fr: RegionVid,
|
||||||
fr_origin: NLLRegionVariableOrigin,
|
fr_origin: NllRegionVariableOrigin,
|
||||||
outlived_fr: RegionVid,
|
outlived_fr: RegionVid,
|
||||||
outlives_suggestion: &mut OutlivesSuggestionBuilder,
|
outlives_suggestion: &mut OutlivesSuggestionBuilder,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
use super::{OutlivesConstraint, RegionInferenceContext};
|
use super::{OutlivesConstraint, RegionInferenceContext};
|
||||||
use crate::borrow_check::type_check::Locations;
|
use crate::borrow_check::type_check::Locations;
|
||||||
use rustc_infer::infer::NLLRegionVariableOrigin;
|
use rustc_infer::infer::NllRegionVariableOrigin;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
writeln!(out, "| Free Region Mapping")?;
|
writeln!(out, "| Free Region Mapping")?;
|
||||||
|
|
||||||
for region in self.regions() {
|
for region in self.regions() {
|
||||||
if let NLLRegionVariableOrigin::FreeRegion = self.definitions[region].origin {
|
if let NllRegionVariableOrigin::FreeRegion = self.definitions[region].origin {
|
||||||
let classification = self.universal_regions.region_classification(region).unwrap();
|
let classification = self.universal_regions.region_classification(region).unwrap();
|
||||||
let outlived_by = self.universal_region_relations.regions_outlived_by(region);
|
let outlived_by = self.universal_region_relations.regions_outlived_by(region);
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|
|
@ -9,7 +9,7 @@ use rustc_hir::def_id::DefId;
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_infer::infer::canonical::QueryOutlivesConstraint;
|
use rustc_infer::infer::canonical::QueryOutlivesConstraint;
|
||||||
use rustc_infer::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
|
use rustc_infer::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
|
||||||
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin};
|
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin};
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
Body, ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements,
|
Body, ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements,
|
||||||
ConstraintCategory, Local, Location, ReturnConstraint,
|
ConstraintCategory, Local, Location, ReturnConstraint,
|
||||||
|
@ -143,9 +143,9 @@ pub(crate) struct AppliedMemberConstraint {
|
||||||
|
|
||||||
pub(crate) struct RegionDefinition<'tcx> {
|
pub(crate) struct RegionDefinition<'tcx> {
|
||||||
/// What kind of variable is this -- a free region? existential
|
/// What kind of variable is this -- a free region? existential
|
||||||
/// variable? etc. (See the `NLLRegionVariableOrigin` for more
|
/// variable? etc. (See the `NllRegionVariableOrigin` for more
|
||||||
/// info.)
|
/// info.)
|
||||||
pub(in crate::borrow_check) origin: NLLRegionVariableOrigin,
|
pub(in crate::borrow_check) origin: NllRegionVariableOrigin,
|
||||||
|
|
||||||
/// Which universe is this region variable defined in? This is
|
/// Which universe is this region variable defined in? This is
|
||||||
/// most often `ty::UniverseIndex::ROOT`, but when we encounter
|
/// most often `ty::UniverseIndex::ROOT`, but when we encounter
|
||||||
|
@ -451,7 +451,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
let scc = self.constraint_sccs.scc(variable);
|
let scc = self.constraint_sccs.scc(variable);
|
||||||
|
|
||||||
match self.definitions[variable].origin {
|
match self.definitions[variable].origin {
|
||||||
NLLRegionVariableOrigin::FreeRegion => {
|
NllRegionVariableOrigin::FreeRegion => {
|
||||||
// For each free, universally quantified region X:
|
// For each free, universally quantified region X:
|
||||||
|
|
||||||
// Add all nodes in the CFG to liveness constraints
|
// Add all nodes in the CFG to liveness constraints
|
||||||
|
@ -462,7 +462,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
self.scc_values.add_element(scc, variable);
|
self.scc_values.add_element(scc, variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Placeholder(placeholder) => {
|
NllRegionVariableOrigin::Placeholder(placeholder) => {
|
||||||
// Each placeholder region is only visible from
|
// Each placeholder region is only visible from
|
||||||
// its universe `ui` and its extensions. So we
|
// its universe `ui` and its extensions. So we
|
||||||
// can't just add it into `scc` unless the
|
// can't just add it into `scc` unless the
|
||||||
|
@ -480,8 +480,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::RootEmptyRegion
|
NllRegionVariableOrigin::RootEmptyRegion
|
||||||
| NLLRegionVariableOrigin::Existential { .. } => {
|
| NllRegionVariableOrigin::Existential { .. } => {
|
||||||
// For existential, regions, nothing to do.
|
// For existential, regions, nothing to do.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1348,7 +1348,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
) {
|
) {
|
||||||
for (fr, fr_definition) in self.definitions.iter_enumerated() {
|
for (fr, fr_definition) in self.definitions.iter_enumerated() {
|
||||||
match fr_definition.origin {
|
match fr_definition.origin {
|
||||||
NLLRegionVariableOrigin::FreeRegion => {
|
NllRegionVariableOrigin::FreeRegion => {
|
||||||
// Go through each of the universal regions `fr` and check that
|
// Go through each of the universal regions `fr` and check that
|
||||||
// they did not grow too large, accumulating any requirements
|
// they did not grow too large, accumulating any requirements
|
||||||
// for our caller into the `outlives_requirements` vector.
|
// for our caller into the `outlives_requirements` vector.
|
||||||
|
@ -1360,12 +1360,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Placeholder(placeholder) => {
|
NllRegionVariableOrigin::Placeholder(placeholder) => {
|
||||||
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::RootEmptyRegion
|
NllRegionVariableOrigin::RootEmptyRegion
|
||||||
| NLLRegionVariableOrigin::Existential { .. } => {
|
| NllRegionVariableOrigin::Existential { .. } => {
|
||||||
// nothing to check here
|
// nothing to check here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1449,7 +1449,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
errors_buffer.push(RegionErrorKind::RegionError {
|
errors_buffer.push(RegionErrorKind::RegionError {
|
||||||
longer_fr: *longer_fr,
|
longer_fr: *longer_fr,
|
||||||
shorter_fr: *shorter_fr,
|
shorter_fr: *shorter_fr,
|
||||||
fr_origin: NLLRegionVariableOrigin::FreeRegion,
|
fr_origin: NllRegionVariableOrigin::FreeRegion,
|
||||||
is_reported: true,
|
is_reported: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1459,16 +1459,16 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
// a more complete picture on how to separate this responsibility.
|
// a more complete picture on how to separate this responsibility.
|
||||||
for (fr, fr_definition) in self.definitions.iter_enumerated() {
|
for (fr, fr_definition) in self.definitions.iter_enumerated() {
|
||||||
match fr_definition.origin {
|
match fr_definition.origin {
|
||||||
NLLRegionVariableOrigin::FreeRegion => {
|
NllRegionVariableOrigin::FreeRegion => {
|
||||||
// handled by polonius above
|
// handled by polonius above
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::Placeholder(placeholder) => {
|
NllRegionVariableOrigin::Placeholder(placeholder) => {
|
||||||
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
self.check_bound_universal_region(fr, placeholder, errors_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::RootEmptyRegion
|
NllRegionVariableOrigin::RootEmptyRegion
|
||||||
| NLLRegionVariableOrigin::Existential { .. } => {
|
| NllRegionVariableOrigin::Existential { .. } => {
|
||||||
// nothing to check here
|
// nothing to check here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1516,7 +1516,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
errors_buffer.push(RegionErrorKind::RegionError {
|
errors_buffer.push(RegionErrorKind::RegionError {
|
||||||
longer_fr,
|
longer_fr,
|
||||||
shorter_fr: representative,
|
shorter_fr: representative,
|
||||||
fr_origin: NLLRegionVariableOrigin::FreeRegion,
|
fr_origin: NllRegionVariableOrigin::FreeRegion,
|
||||||
is_reported: true,
|
is_reported: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1539,7 +1539,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
errors_buffer.push(RegionErrorKind::RegionError {
|
errors_buffer.push(RegionErrorKind::RegionError {
|
||||||
longer_fr,
|
longer_fr,
|
||||||
shorter_fr,
|
shorter_fr,
|
||||||
fr_origin: NLLRegionVariableOrigin::FreeRegion,
|
fr_origin: NllRegionVariableOrigin::FreeRegion,
|
||||||
is_reported: !error_reported,
|
is_reported: !error_reported,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1597,7 +1597,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
let blame_span_category = self.find_outlives_blame_span(
|
let blame_span_category = self.find_outlives_blame_span(
|
||||||
body,
|
body,
|
||||||
longer_fr,
|
longer_fr,
|
||||||
NLLRegionVariableOrigin::FreeRegion,
|
NllRegionVariableOrigin::FreeRegion,
|
||||||
shorter_fr,
|
shorter_fr,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1656,7 +1656,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
|
errors_buffer.push(RegionErrorKind::BoundUniversalRegionError {
|
||||||
longer_fr,
|
longer_fr,
|
||||||
error_element,
|
error_element,
|
||||||
fr_origin: NLLRegionVariableOrigin::Placeholder(placeholder),
|
fr_origin: NllRegionVariableOrigin::Placeholder(placeholder),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1732,7 +1732,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
debug!("cannot_name_value_of(r1={:?}, r2={:?})", r1, r2);
|
debug!("cannot_name_value_of(r1={:?}, r2={:?})", r1, r2);
|
||||||
|
|
||||||
match self.definitions[r2].origin {
|
match self.definitions[r2].origin {
|
||||||
NLLRegionVariableOrigin::Placeholder(placeholder) => {
|
NllRegionVariableOrigin::Placeholder(placeholder) => {
|
||||||
let universe1 = self.definitions[r1].universe;
|
let universe1 = self.definitions[r1].universe;
|
||||||
debug!(
|
debug!(
|
||||||
"cannot_name_value_of: universe1={:?} placeholder={:?}",
|
"cannot_name_value_of: universe1={:?} placeholder={:?}",
|
||||||
|
@ -1741,9 +1741,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
universe1.cannot_name(placeholder.universe)
|
universe1.cannot_name(placeholder.universe)
|
||||||
}
|
}
|
||||||
|
|
||||||
NLLRegionVariableOrigin::RootEmptyRegion
|
NllRegionVariableOrigin::RootEmptyRegion
|
||||||
| NLLRegionVariableOrigin::FreeRegion
|
| NllRegionVariableOrigin::FreeRegion
|
||||||
| NLLRegionVariableOrigin::Existential { .. } => false,
|
| NllRegionVariableOrigin::Existential { .. } => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1771,7 +1771,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
body: &Body<'tcx>,
|
||||||
fr1: RegionVid,
|
fr1: RegionVid,
|
||||||
fr1_origin: NLLRegionVariableOrigin,
|
fr1_origin: NllRegionVariableOrigin,
|
||||||
fr2: RegionVid,
|
fr2: RegionVid,
|
||||||
) -> (ConstraintCategory, Span) {
|
) -> (ConstraintCategory, Span) {
|
||||||
let (category, _, span) = self.best_blame_constraint(body, fr1, fr1_origin, |r| {
|
let (category, _, span) = self.best_blame_constraint(body, fr1, fr1_origin, |r| {
|
||||||
|
@ -1933,7 +1933,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
.definitions
|
.definitions
|
||||||
.iter_enumerated()
|
.iter_enumerated()
|
||||||
.find_map(|(r, definition)| match definition.origin {
|
.find_map(|(r, definition)| match definition.origin {
|
||||||
NLLRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
|
NllRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
@ -1965,7 +1965,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
body: &Body<'tcx>,
|
||||||
from_region: RegionVid,
|
from_region: RegionVid,
|
||||||
from_region_origin: NLLRegionVariableOrigin,
|
from_region_origin: NllRegionVariableOrigin,
|
||||||
target_test: impl Fn(RegionVid) -> bool,
|
target_test: impl Fn(RegionVid) -> bool,
|
||||||
) -> (ConstraintCategory, bool, Span) {
|
) -> (ConstraintCategory, bool, Span) {
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -2059,11 +2059,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
//
|
//
|
||||||
// and here we prefer to blame the source (the y = x statement).
|
// and here we prefer to blame the source (the y = x statement).
|
||||||
let blame_source = match from_region_origin {
|
let blame_source = match from_region_origin {
|
||||||
NLLRegionVariableOrigin::FreeRegion
|
NllRegionVariableOrigin::FreeRegion
|
||||||
| NLLRegionVariableOrigin::Existential { from_forall: false } => true,
|
| NllRegionVariableOrigin::Existential { from_forall: false } => true,
|
||||||
NLLRegionVariableOrigin::RootEmptyRegion
|
NllRegionVariableOrigin::RootEmptyRegion
|
||||||
| NLLRegionVariableOrigin::Placeholder(_)
|
| NllRegionVariableOrigin::Placeholder(_)
|
||||||
| NLLRegionVariableOrigin::Existential { from_forall: true } => false,
|
| NllRegionVariableOrigin::Existential { from_forall: true } => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let find_region = |i: &usize| {
|
let find_region = |i: &usize| {
|
||||||
|
@ -2144,8 +2144,8 @@ impl<'tcx> RegionDefinition<'tcx> {
|
||||||
// `init_universal_regions`.
|
// `init_universal_regions`.
|
||||||
|
|
||||||
let origin = match rv_origin {
|
let origin = match rv_origin {
|
||||||
RegionVariableOrigin::NLL(origin) => origin,
|
RegionVariableOrigin::Nll(origin) => origin,
|
||||||
_ => NLLRegionVariableOrigin::Existential { from_forall: false },
|
_ => NllRegionVariableOrigin::Existential { from_forall: false },
|
||||||
};
|
};
|
||||||
|
|
||||||
Self { origin, universe, external_name: None }
|
Self { origin, universe, external_name: None }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
|
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
|
||||||
use rustc_middle::mir::visit::{MutVisitor, TyContext};
|
use rustc_middle::mir::visit::{MutVisitor, TyContext};
|
||||||
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
|
use rustc_middle::mir::{Body, Location, PlaceElem, Promoted};
|
||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
|
@ -15,7 +15,7 @@ pub fn renumber_mir<'tcx>(
|
||||||
debug!("renumber_mir()");
|
debug!("renumber_mir()");
|
||||||
debug!("renumber_mir: body.arg_count={:?}", body.arg_count);
|
debug!("renumber_mir: body.arg_count={:?}", body.arg_count);
|
||||||
|
|
||||||
let mut visitor = NLLVisitor { infcx };
|
let mut visitor = NllVisitor { infcx };
|
||||||
|
|
||||||
for body in promoted.iter_mut() {
|
for body in promoted.iter_mut() {
|
||||||
visitor.visit_body(body);
|
visitor.visit_body(body);
|
||||||
|
@ -33,16 +33,16 @@ where
|
||||||
debug!("renumber_regions(value={:?})", value);
|
debug!("renumber_regions(value={:?})", value);
|
||||||
|
|
||||||
infcx.tcx.fold_regions(value, &mut false, |_region, _depth| {
|
infcx.tcx.fold_regions(value, &mut false, |_region, _depth| {
|
||||||
let origin = NLLRegionVariableOrigin::Existential { from_forall: false };
|
let origin = NllRegionVariableOrigin::Existential { from_forall: false };
|
||||||
infcx.next_nll_region_var(origin)
|
infcx.next_nll_region_var(origin)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NLLVisitor<'a, 'tcx> {
|
struct NllVisitor<'a, 'tcx> {
|
||||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> NLLVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
|
||||||
fn renumber_regions<T>(&mut self, value: T) -> T
|
fn renumber_regions<T>(&mut self, value: T) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
|
@ -51,7 +51,7 @@ impl<'a, 'tcx> NLLVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
|
||||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||||
self.infcx.tcx
|
self.infcx.tcx
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
|
||||||
use rustc_infer::infer::outlives::env::RegionBoundPairs;
|
use rustc_infer::infer::outlives::env::RegionBoundPairs;
|
||||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||||
use rustc_infer::infer::{
|
use rustc_infer::infer::{
|
||||||
InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin,
|
InferCtxt, InferOk, LateBoundRegionConversionTime, NllRegionVariableOrigin,
|
||||||
};
|
};
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
|
||||||
|
@ -876,7 +876,7 @@ impl MirTypeckRegionConstraints<'tcx> {
|
||||||
match self.placeholder_index_to_region.get(placeholder_index) {
|
match self.placeholder_index_to_region.get(placeholder_index) {
|
||||||
Some(&v) => v,
|
Some(&v) => v,
|
||||||
None => {
|
None => {
|
||||||
let origin = NLLRegionVariableOrigin::Placeholder(placeholder);
|
let origin = NllRegionVariableOrigin::Placeholder(placeholder);
|
||||||
let region = infcx.next_nll_region_var_in_universe(origin, placeholder.universe);
|
let region = infcx.next_nll_region_var_in_universe(origin, placeholder.universe);
|
||||||
self.placeholder_index_to_region.push(region);
|
self.placeholder_index_to_region.push(region);
|
||||||
region
|
region
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use rustc_infer::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
|
use rustc_infer::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
|
||||||
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
|
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
|
||||||
use rustc_middle::mir::ConstraintCategory;
|
use rustc_middle::mir::ConstraintCategory;
|
||||||
use rustc_middle::ty::relate::TypeRelation;
|
use rustc_middle::ty::relate::TypeRelation;
|
||||||
use rustc_middle::ty::{self, Const, Ty};
|
use rustc_middle::ty::{self, Const, Ty};
|
||||||
|
@ -64,7 +64,7 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||||
|
|
||||||
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
|
fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> {
|
||||||
if self.borrowck_context.is_some() {
|
if self.borrowck_context.is_some() {
|
||||||
let origin = NLLRegionVariableOrigin::Existential { from_forall };
|
let origin = NllRegionVariableOrigin::Existential { from_forall };
|
||||||
self.infcx.next_nll_region_var(origin)
|
self.infcx.next_nll_region_var(origin)
|
||||||
} else {
|
} else {
|
||||||
self.infcx.tcx.lifetimes.re_erased
|
self.infcx.tcx.lifetimes.re_erased
|
||||||
|
@ -81,7 +81,7 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||||
|
|
||||||
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
|
fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> {
|
||||||
self.infcx.next_nll_region_var_in_universe(
|
self.infcx.next_nll_region_var_in_universe(
|
||||||
NLLRegionVariableOrigin::Existential { from_forall: false },
|
NllRegionVariableOrigin::Existential { from_forall: false },
|
||||||
universe,
|
universe,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_hir::{BodyOwnerKind, HirId};
|
use rustc_hir::{BodyOwnerKind, HirId};
|
||||||
use rustc_index::vec::{Idx, IndexVec};
|
use rustc_index::vec::{Idx, IndexVec};
|
||||||
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
|
use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
|
||||||
use rustc_middle::ty::fold::TypeFoldable;
|
use rustc_middle::ty::fold::TypeFoldable;
|
||||||
use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef};
|
use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef};
|
||||||
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
|
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
|
||||||
|
@ -393,7 +393,7 @@ struct UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const FR: NLLRegionVariableOrigin = NLLRegionVariableOrigin::FreeRegion;
|
const FR: NllRegionVariableOrigin = NllRegionVariableOrigin::FreeRegion;
|
||||||
|
|
||||||
impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
fn build(self) -> UniversalRegions<'tcx> {
|
fn build(self) -> UniversalRegions<'tcx> {
|
||||||
|
@ -486,7 +486,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
|
|
||||||
let root_empty = self
|
let root_empty = self
|
||||||
.infcx
|
.infcx
|
||||||
.next_nll_region_var(NLLRegionVariableOrigin::RootEmptyRegion)
|
.next_nll_region_var(NllRegionVariableOrigin::RootEmptyRegion)
|
||||||
.to_region_vid();
|
.to_region_vid();
|
||||||
|
|
||||||
UniversalRegions {
|
UniversalRegions {
|
||||||
|
@ -647,7 +647,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
||||||
trait InferCtxtExt<'tcx> {
|
trait InferCtxtExt<'tcx> {
|
||||||
fn replace_free_regions_with_nll_infer_vars<T>(
|
fn replace_free_regions_with_nll_infer_vars<T>(
|
||||||
&self,
|
&self,
|
||||||
origin: NLLRegionVariableOrigin,
|
origin: NllRegionVariableOrigin,
|
||||||
value: T,
|
value: T,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
|
@ -655,7 +655,7 @@ trait InferCtxtExt<'tcx> {
|
||||||
|
|
||||||
fn replace_bound_regions_with_nll_infer_vars<T>(
|
fn replace_bound_regions_with_nll_infer_vars<T>(
|
||||||
&self,
|
&self,
|
||||||
origin: NLLRegionVariableOrigin,
|
origin: NllRegionVariableOrigin,
|
||||||
all_outlive_scope: LocalDefId,
|
all_outlive_scope: LocalDefId,
|
||||||
value: ty::Binder<T>,
|
value: ty::Binder<T>,
|
||||||
indices: &mut UniversalRegionIndices<'tcx>,
|
indices: &mut UniversalRegionIndices<'tcx>,
|
||||||
|
@ -673,7 +673,7 @@ trait InferCtxtExt<'tcx> {
|
||||||
impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||||
fn replace_free_regions_with_nll_infer_vars<T>(
|
fn replace_free_regions_with_nll_infer_vars<T>(
|
||||||
&self,
|
&self,
|
||||||
origin: NLLRegionVariableOrigin,
|
origin: NllRegionVariableOrigin,
|
||||||
value: T,
|
value: T,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
|
@ -684,7 +684,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||||
|
|
||||||
fn replace_bound_regions_with_nll_infer_vars<T>(
|
fn replace_bound_regions_with_nll_infer_vars<T>(
|
||||||
&self,
|
&self,
|
||||||
origin: NLLRegionVariableOrigin,
|
origin: NllRegionVariableOrigin,
|
||||||
all_outlive_scope: LocalDefId,
|
all_outlive_scope: LocalDefId,
|
||||||
value: ty::Binder<T>,
|
value: ty::Binder<T>,
|
||||||
indices: &mut UniversalRegionIndices<'tcx>,
|
indices: &mut UniversalRegionIndices<'tcx>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue