Add outlives_constraint to BlameConstraint
This commit is contained in:
parent
67653292be
commit
ec17be2656
@ -310,11 +310,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
borrow_region: RegionVid,
|
||||
outlived_region: RegionVid,
|
||||
) -> (ConstraintCategory<'tcx>, bool, Span, Option<RegionName>) {
|
||||
let BlameConstraint { category, from_closure, cause, variance_info: _ } = self
|
||||
.regioncx
|
||||
.best_blame_constraint(borrow_region, NllRegionVariableOrigin::FreeRegion, |r| {
|
||||
self.regioncx.provides_universal_region(r, borrow_region, outlived_region)
|
||||
});
|
||||
let blame_constraint = self.regioncx.best_blame_constraint(
|
||||
borrow_region,
|
||||
NllRegionVariableOrigin::FreeRegion,
|
||||
|r| self.regioncx.provides_universal_region(r, borrow_region, outlived_region),
|
||||
);
|
||||
let BlameConstraint { category, from_closure, cause, .. } = blame_constraint;
|
||||
|
||||
let outlived_fr_name = self.give_region_a_name(outlived_region);
|
||||
|
||||
|
@ -354,7 +354,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
) {
|
||||
debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr);
|
||||
|
||||
let BlameConstraint { category, cause, variance_info, from_closure: _ } =
|
||||
let BlameConstraint { category, cause, variance_info, .. } =
|
||||
self.regioncx.best_blame_constraint(fr, fr_origin, |r| {
|
||||
self.regioncx.provides_universal_region(r, fr, outlived_fr)
|
||||
});
|
||||
|
@ -2073,6 +2073,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
from_closure,
|
||||
cause: ObligationCause::new(span, CRATE_HIR_ID, cause_code),
|
||||
variance_info: constraint.variance_info,
|
||||
outlives_constraint: *constraint,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -2328,4 +2329,5 @@ pub struct BlameConstraint<'tcx> {
|
||||
pub from_closure: bool,
|
||||
pub cause: ObligationCause<'tcx>,
|
||||
pub variance_info: ty::VarianceDiagInfo<'tcx>,
|
||||
pub outlives_constraint: OutlivesConstraint<'tcx>,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user