diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-11-13 14:49:16 +0000 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-11-13 16:28:28 +0000 |
| commit | fb94626431e2637306aede1095cb66e6bbb43777 (patch) | |
| tree | 4b10db1a13b1b7b49fe6a79d6e00ba5feec85ec5 | |
| parent | 3e3e7a023fa7b4d3ea11009565b09b1ec64c2b86 (diff) | |
| download | rust-fb94626431e2637306aede1095cb66e6bbb43777.tar.gz rust-fb94626431e2637306aede1095cb66e6bbb43777.zip | |
add locations instead of "element"s, and remove unused return value
| -rw-r--r-- | compiler/rustc_borrowck/src/constraint_generation.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/values.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_borrowck/src/type_check/mod.rs | 6 |
3 files changed, 9 insertions, 10 deletions
diff --git a/compiler/rustc_borrowck/src/constraint_generation.rs b/compiler/rustc_borrowck/src/constraint_generation.rs index 1f642099f08..02b3bed94bf 100644 --- a/compiler/rustc_borrowck/src/constraint_generation.rs +++ b/compiler/rustc_borrowck/src/constraint_generation.rs @@ -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); }); } diff --git a/compiler/rustc_borrowck/src/region_infer/values.rs b/compiler/rustc_borrowck/src/region_infer/values.rs index 48bfd6bd132..03630f0e2bc 100644 --- a/compiler/rustc_borrowck/src/region_infer/values.rs +++ b/compiler/rustc_borrowck/src/region_infer/values.rs @@ -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 diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 96c23cfaf77..f00e41e0886 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -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); |
