Skip to content

Commit fb94626

Browse files
committed
add locations instead of "element"s, and remove unused return value
1 parent 3e3e7a0 commit fb94626

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

compiler/rustc_borrowck/src/constraint_generation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
167167

168168
self.infcx.tcx.for_each_free_region(&live_ty, |live_region| {
169169
let vid = live_region.as_var();
170-
self.liveness_constraints.add_element(vid, location);
170+
self.liveness_constraints.add_location(vid, location);
171171
});
172172
}
173173

compiler/rustc_borrowck/src/region_infer/values.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ impl<N: Idx> LivenessValues<N> {
136136
self.points.rows()
137137
}
138138

139-
/// Adds the given element to the value for the given region. Returns whether
140-
/// the element is newly added (i.e., was not already present).
141-
pub(crate) fn add_element(&mut self, region: N, location: Location) -> bool {
142-
debug!("LivenessValues::add_element(region={:?}, location={:?})", region, location);
143-
let index = self.elements.point_from_location(location);
144-
self.points.insert(region, index)
139+
/// Records `region` as being live at the given `location`.
140+
pub(crate) fn add_location(&mut self, region: N, location: Location) {
141+
debug!("LivenessValues::add_location(region={:?}, location={:?})", region, location);
142+
let point = self.elements.point_from_location(location);
143+
self.points.insert(region, point);
145144
}
146145

147146
/// Adds all the elements in the given bit array into the given

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
318318
.borrowck_context
319319
.constraints
320320
.liveness_constraints
321-
.add_element(live_region_vid, location);
321+
.add_location(live_region_vid, location);
322322
});
323323

324324
// HACK(compiler-errors): Constants that are gathered into Body.required_consts
@@ -601,7 +601,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
601601
.borrowck_context
602602
.constraints
603603
.liveness_constraints
604-
.add_element(region, location);
604+
.add_location(region, location);
605605
}
606606
}
607607
}
@@ -1443,7 +1443,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14431443
self.borrowck_context
14441444
.constraints
14451445
.liveness_constraints
1446-
.add_element(region_vid, term_location);
1446+
.add_location(region_vid, term_location);
14471447
}
14481448

14491449
self.check_call_inputs(body, term, func, &sig, args, term_location, *call_source);

0 commit comments

Comments
 (0)