rename debugging support functions
This commit is contained in:
parent
84a002cc42
commit
d203476c4f
@ -67,7 +67,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
|
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
for region in self.definitions.indices() {
|
for region in self.definitions.indices() {
|
||||||
let value = self.liveness_constraints.region_value_str(region);
|
let value = self.liveness_constraints.pretty_print_live_points(region);
|
||||||
if value != "{}" {
|
if value != "{}" {
|
||||||
with_msg(&format!("{region:?} live at {value}"))?;
|
with_msg(&format!("{region:?} live at {value}"))?;
|
||||||
}
|
}
|
||||||
|
@ -1970,7 +1970,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
|
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
|
||||||
self.find_constraint_paths_between_regions(fr1, |r| {
|
self.find_constraint_paths_between_regions(fr1, |r| {
|
||||||
// First look for some `r` such that `fr1: r` and `r` is live at `location`
|
// First look for some `r` such that `fr1: r` and `r` is live at `location`
|
||||||
trace!(?r, liveness_constraints=?self.liveness_constraints.region_value_str(r));
|
trace!(?r, liveness_constraints=?self.liveness_constraints.pretty_print_live_points(r));
|
||||||
self.liveness_constraints.is_live_at(r, location)
|
self.liveness_constraints.is_live_at(r, location)
|
||||||
})
|
})
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
|
@ -172,9 +172,10 @@ impl LivenessValues {
|
|||||||
.take_while(|&p| self.elements.point_in_range(p))
|
.take_while(|&p| self.elements.point_in_range(p))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a "pretty" string value of the region. Meant for debugging.
|
/// For debugging purposes, returns a pretty-printed string of the points where the `region` is
|
||||||
pub(crate) fn region_value_str(&self, region: RegionVid) -> String {
|
/// live.
|
||||||
region_value_str(
|
pub(crate) fn pretty_print_live_points(&self, region: RegionVid) -> String {
|
||||||
|
pretty_print_region_elements(
|
||||||
self.live_points(region).map(|p| RegionElement::Location(self.elements.to_location(p))),
|
self.live_points(region).map(|p| RegionElement::Location(self.elements.to_location(p))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -378,7 +379,7 @@ impl<N: Idx> RegionValues<N> {
|
|||||||
|
|
||||||
/// Returns a "pretty" string value of the region. Meant for debugging.
|
/// Returns a "pretty" string value of the region. Meant for debugging.
|
||||||
pub(crate) fn region_value_str(&self, r: N) -> String {
|
pub(crate) fn region_value_str(&self, r: N) -> String {
|
||||||
region_value_str(self.elements_contained_in(r))
|
pretty_print_region_elements(self.elements_contained_in(r))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,11 +423,12 @@ impl ToElementIndex for ty::PlaceholderRegion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn location_set_str(
|
/// For debugging purposes, returns a pretty-printed string of the given points.
|
||||||
|
pub(crate) fn pretty_print_points(
|
||||||
elements: &RegionValueElements,
|
elements: &RegionValueElements,
|
||||||
points: impl IntoIterator<Item = PointIndex>,
|
points: impl IntoIterator<Item = PointIndex>,
|
||||||
) -> String {
|
) -> String {
|
||||||
region_value_str(
|
pretty_print_region_elements(
|
||||||
points
|
points
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.take_while(|&p| elements.point_in_range(p))
|
.take_while(|&p| elements.point_in_range(p))
|
||||||
@ -435,7 +437,8 @@ pub(crate) fn location_set_str(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn region_value_str(elements: impl IntoIterator<Item = RegionElement>) -> String {
|
/// For debugging purposes, returns a pretty-printed string of the given region elements.
|
||||||
|
fn pretty_print_region_elements(elements: impl IntoIterator<Item = RegionElement>) -> String {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
result.push('{');
|
result.push('{');
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
|
|||||||
dropped_local,
|
dropped_local,
|
||||||
dropped_ty,
|
dropped_ty,
|
||||||
drop_locations,
|
drop_locations,
|
||||||
values::location_set_str(self.elements, live_at.iter()),
|
values::pretty_print_points(self.elements, live_at.iter()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({
|
let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({
|
||||||
@ -599,7 +599,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
|
|||||||
debug!("make_all_regions_live(value={:?})", value);
|
debug!("make_all_regions_live(value={:?})", value);
|
||||||
debug!(
|
debug!(
|
||||||
"make_all_regions_live: live_at={}",
|
"make_all_regions_live: live_at={}",
|
||||||
values::location_set_str(elements, live_at.iter()),
|
values::pretty_print_points(elements, live_at.iter()),
|
||||||
);
|
);
|
||||||
|
|
||||||
// When using `-Zpolonius=next`, we want to record the loans that flow into this value's
|
// When using `-Zpolonius=next`, we want to record the loans that flow into this value's
|
||||||
|
Loading…
x
Reference in New Issue
Block a user