Remove unused body args
This commit is contained in:
parent
17cbdfd071
commit
2be6301857
3 changed files with 10 additions and 31 deletions
|
@ -310,13 +310,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
borrow_region: RegionVid,
|
borrow_region: RegionVid,
|
||||||
outlived_region: RegionVid,
|
outlived_region: RegionVid,
|
||||||
) -> (ConstraintCategory<'tcx>, bool, Span, Option<RegionName>) {
|
) -> (ConstraintCategory<'tcx>, bool, Span, Option<RegionName>) {
|
||||||
let BlameConstraint { category, from_closure, cause, variance_info: _ } =
|
let BlameConstraint { category, from_closure, cause, variance_info: _ } = self
|
||||||
self.regioncx.best_blame_constraint(
|
.regioncx
|
||||||
&self.body,
|
.best_blame_constraint(borrow_region, NllRegionVariableOrigin::FreeRegion, |r| {
|
||||||
borrow_region,
|
self.regioncx.provides_universal_region(r, borrow_region, outlived_region)
|
||||||
NllRegionVariableOrigin::FreeRegion,
|
});
|
||||||
|r| self.regioncx.provides_universal_region(r, borrow_region, outlived_region),
|
|
||||||
);
|
|
||||||
|
|
||||||
let outlived_fr_name = self.give_region_a_name(outlived_region);
|
let outlived_fr_name = self.give_region_a_name(outlived_region);
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
|
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
|
||||||
let (_, cause) = self.regioncx.find_outlives_blame_span(
|
let (_, cause) = self.regioncx.find_outlives_blame_span(
|
||||||
&self.body,
|
|
||||||
longer_fr,
|
longer_fr,
|
||||||
NllRegionVariableOrigin::Placeholder(placeholder),
|
NllRegionVariableOrigin::Placeholder(placeholder),
|
||||||
error_vid,
|
error_vid,
|
||||||
|
@ -356,7 +355,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr);
|
debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr);
|
||||||
|
|
||||||
let BlameConstraint { category, cause, variance_info, from_closure: _ } =
|
let BlameConstraint { category, cause, variance_info, from_closure: _ } =
|
||||||
self.regioncx.best_blame_constraint(&self.body, fr, fr_origin, |r| {
|
self.regioncx.best_blame_constraint(fr, fr_origin, |r| {
|
||||||
self.regioncx.provides_universal_region(r, fr, outlived_fr)
|
self.regioncx.provides_universal_region(r, fr, outlived_fr)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -590,13 +590,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
// constraints were too strong, and if so, emit or propagate those errors.
|
// constraints were too strong, and if so, emit or propagate those errors.
|
||||||
if infcx.tcx.sess.opts.unstable_opts.polonius {
|
if infcx.tcx.sess.opts.unstable_opts.polonius {
|
||||||
self.check_polonius_subset_errors(
|
self.check_polonius_subset_errors(
|
||||||
body,
|
|
||||||
outlives_requirements.as_mut(),
|
outlives_requirements.as_mut(),
|
||||||
&mut errors_buffer,
|
&mut errors_buffer,
|
||||||
polonius_output.expect("Polonius output is unavailable despite `-Z polonius`"),
|
polonius_output.expect("Polonius output is unavailable despite `-Z polonius`"),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
self.check_universal_regions(body, outlives_requirements.as_mut(), &mut errors_buffer);
|
self.check_universal_regions(outlives_requirements.as_mut(), &mut errors_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if errors_buffer.is_empty() {
|
if errors_buffer.is_empty() {
|
||||||
|
@ -1409,7 +1408,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
/// report them as errors.
|
/// report them as errors.
|
||||||
fn check_universal_regions(
|
fn check_universal_regions(
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
|
||||||
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||||
errors_buffer: &mut RegionErrors<'tcx>,
|
errors_buffer: &mut RegionErrors<'tcx>,
|
||||||
) {
|
) {
|
||||||
|
@ -1420,7 +1418,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
// 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.
|
||||||
self.check_universal_region(
|
self.check_universal_region(
|
||||||
body,
|
|
||||||
fr,
|
fr,
|
||||||
&mut propagated_outlives_requirements,
|
&mut propagated_outlives_requirements,
|
||||||
errors_buffer,
|
errors_buffer,
|
||||||
|
@ -1461,7 +1458,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
/// report them as errors.
|
/// report them as errors.
|
||||||
fn check_polonius_subset_errors(
|
fn check_polonius_subset_errors(
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
|
||||||
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||||
errors_buffer: &mut RegionErrors<'tcx>,
|
errors_buffer: &mut RegionErrors<'tcx>,
|
||||||
polonius_output: Rc<PoloniusOutput>,
|
polonius_output: Rc<PoloniusOutput>,
|
||||||
|
@ -1508,7 +1504,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
let propagated = self.try_propagate_universal_region_error(
|
let propagated = self.try_propagate_universal_region_error(
|
||||||
*longer_fr,
|
*longer_fr,
|
||||||
*shorter_fr,
|
*shorter_fr,
|
||||||
body,
|
|
||||||
&mut propagated_outlives_requirements,
|
&mut propagated_outlives_requirements,
|
||||||
);
|
);
|
||||||
if propagated == RegionRelationCheckResult::Error {
|
if propagated == RegionRelationCheckResult::Error {
|
||||||
|
@ -1548,13 +1543,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
///
|
///
|
||||||
/// Things that are to be propagated are accumulated into the
|
/// Things that are to be propagated are accumulated into the
|
||||||
/// `outlives_requirements` vector.
|
/// `outlives_requirements` vector.
|
||||||
#[instrument(
|
#[instrument(skip(self, propagated_outlives_requirements, errors_buffer), level = "debug")]
|
||||||
skip(self, body, propagated_outlives_requirements, errors_buffer),
|
|
||||||
level = "debug"
|
|
||||||
)]
|
|
||||||
fn check_universal_region(
|
fn check_universal_region(
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
|
||||||
longer_fr: RegionVid,
|
longer_fr: RegionVid,
|
||||||
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||||
errors_buffer: &mut RegionErrors<'tcx>,
|
errors_buffer: &mut RegionErrors<'tcx>,
|
||||||
|
@ -1577,7 +1568,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
|
if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
|
||||||
longer_fr,
|
longer_fr,
|
||||||
representative,
|
representative,
|
||||||
body,
|
|
||||||
propagated_outlives_requirements,
|
propagated_outlives_requirements,
|
||||||
) {
|
) {
|
||||||
errors_buffer.push(RegionErrorKind::RegionError {
|
errors_buffer.push(RegionErrorKind::RegionError {
|
||||||
|
@ -1597,7 +1587,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
|
if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
|
||||||
longer_fr,
|
longer_fr,
|
||||||
shorter_fr,
|
shorter_fr,
|
||||||
body,
|
|
||||||
propagated_outlives_requirements,
|
propagated_outlives_requirements,
|
||||||
) {
|
) {
|
||||||
// We only report the first region error. Subsequent errors are hidden so as
|
// We only report the first region error. Subsequent errors are hidden so as
|
||||||
|
@ -1622,7 +1611,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
longer_fr: RegionVid,
|
longer_fr: RegionVid,
|
||||||
shorter_fr: RegionVid,
|
shorter_fr: RegionVid,
|
||||||
body: &Body<'tcx>,
|
|
||||||
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||||
) -> RegionRelationCheckResult {
|
) -> RegionRelationCheckResult {
|
||||||
// If it is known that `fr: o`, carry on.
|
// If it is known that `fr: o`, carry on.
|
||||||
|
@ -1638,7 +1626,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
self.try_propagate_universal_region_error(
|
self.try_propagate_universal_region_error(
|
||||||
longer_fr,
|
longer_fr,
|
||||||
shorter_fr,
|
shorter_fr,
|
||||||
body,
|
|
||||||
propagated_outlives_requirements,
|
propagated_outlives_requirements,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1650,7 +1637,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
&self,
|
&self,
|
||||||
longer_fr: RegionVid,
|
longer_fr: RegionVid,
|
||||||
shorter_fr: RegionVid,
|
shorter_fr: RegionVid,
|
||||||
body: &Body<'tcx>,
|
|
||||||
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||||
) -> RegionRelationCheckResult {
|
) -> RegionRelationCheckResult {
|
||||||
if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
|
if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
|
||||||
|
@ -1662,7 +1648,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
debug!("try_propagate_universal_region_error: fr_minus={:?}", fr_minus);
|
debug!("try_propagate_universal_region_error: fr_minus={:?}", fr_minus);
|
||||||
|
|
||||||
let blame_span_category = self.find_outlives_blame_span(
|
let blame_span_category = self.find_outlives_blame_span(
|
||||||
body,
|
|
||||||
longer_fr,
|
longer_fr,
|
||||||
NllRegionVariableOrigin::FreeRegion,
|
NllRegionVariableOrigin::FreeRegion,
|
||||||
shorter_fr,
|
shorter_fr,
|
||||||
|
@ -1816,7 +1801,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
|
|
||||||
pub(crate) fn retrieve_closure_constraint_info(
|
pub(crate) fn retrieve_closure_constraint_info(
|
||||||
&self,
|
&self,
|
||||||
_body: &Body<'tcx>,
|
|
||||||
constraint: &OutlivesConstraint<'tcx>,
|
constraint: &OutlivesConstraint<'tcx>,
|
||||||
) -> BlameConstraint<'tcx> {
|
) -> BlameConstraint<'tcx> {
|
||||||
let loc = match constraint.locations {
|
let loc = match constraint.locations {
|
||||||
|
@ -1851,13 +1835,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
/// Finds a good `ObligationCause` to blame for the fact that `fr1` outlives `fr2`.
|
/// Finds a good `ObligationCause` to blame for the fact that `fr1` outlives `fr2`.
|
||||||
pub(crate) fn find_outlives_blame_span(
|
pub(crate) fn find_outlives_blame_span(
|
||||||
&self,
|
&self,
|
||||||
body: &Body<'tcx>,
|
|
||||||
fr1: RegionVid,
|
fr1: RegionVid,
|
||||||
fr1_origin: NllRegionVariableOrigin,
|
fr1_origin: NllRegionVariableOrigin,
|
||||||
fr2: RegionVid,
|
fr2: RegionVid,
|
||||||
) -> (ConstraintCategory<'tcx>, ObligationCause<'tcx>) {
|
) -> (ConstraintCategory<'tcx>, ObligationCause<'tcx>) {
|
||||||
let BlameConstraint { category, cause, .. } =
|
let BlameConstraint { category, cause, .. } =
|
||||||
self.best_blame_constraint(body, fr1, fr1_origin, |r| {
|
self.best_blame_constraint(fr1, fr1_origin, |r| {
|
||||||
self.provides_universal_region(r, fr1, fr2)
|
self.provides_universal_region(r, fr1, fr2)
|
||||||
});
|
});
|
||||||
(category, cause)
|
(category, cause)
|
||||||
|
@ -2045,7 +2028,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
#[instrument(level = "debug", skip(self, target_test))]
|
#[instrument(level = "debug", skip(self, target_test))]
|
||||||
pub(crate) fn best_blame_constraint(
|
pub(crate) fn best_blame_constraint(
|
||||||
&self,
|
&self,
|
||||||
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,
|
||||||
|
@ -2091,7 +2073,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|constraint| {
|
.map(|constraint| {
|
||||||
if constraint.category == ConstraintCategory::ClosureBounds {
|
if constraint.category == ConstraintCategory::ClosureBounds {
|
||||||
self.retrieve_closure_constraint_info(body, &constraint)
|
self.retrieve_closure_constraint_info(&constraint)
|
||||||
} else {
|
} else {
|
||||||
BlameConstraint {
|
BlameConstraint {
|
||||||
category: constraint.category,
|
category: constraint.category,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue