add locations instead of "element"s, and remove unused return value

This commit is contained in:
Rémy Rakic 2023-11-13 14:49:16 +00:00
parent 3e3e7a023f
commit fb94626431
3 changed files with 9 additions and 10 deletions

View File

@ -167,7 +167,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
self.infcx.tcx.for_each_free_region(&live_ty, |live_region| {
let vid = live_region.as_var();
self.liveness_constraints.add_element(vid, location);
self.liveness_constraints.add_location(vid, location);
});
}

View File

@ -136,12 +136,11 @@ impl<N: Idx> LivenessValues<N> {
self.points.rows()
}
/// Adds the given element to the value for the given region. Returns whether
/// the element is newly added (i.e., was not already present).
pub(crate) fn add_element(&mut self, region: N, location: Location) -> bool {
debug!("LivenessValues::add_element(region={:?}, location={:?})", region, location);
let index = self.elements.point_from_location(location);
self.points.insert(region, index)
/// Records `region` as being live at the given `location`.
pub(crate) fn add_location(&mut self, region: N, location: Location) {
debug!("LivenessValues::add_location(region={:?}, location={:?})", region, location);
let point = self.elements.point_from_location(location);
self.points.insert(region, point);
}
/// Adds all the elements in the given bit array into the given

View File

@ -318,7 +318,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
.borrowck_context
.constraints
.liveness_constraints
.add_element(live_region_vid, location);
.add_location(live_region_vid, location);
});
// HACK(compiler-errors): Constants that are gathered into Body.required_consts
@ -601,7 +601,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
.borrowck_context
.constraints
.liveness_constraints
.add_element(region, location);
.add_location(region, location);
}
}
}
@ -1443,7 +1443,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
self.borrowck_context
.constraints
.liveness_constraints
.add_element(region_vid, term_location);
.add_location(region_vid, term_location);
}
self.check_call_inputs(body, term, func, &sig, args, term_location, *call_source);