Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions compiler/rustc_borrowck/src/region_infer/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,6 @@ impl<'tcx, N: Idx> RegionValues<'tcx, N> {
}
}

/// For debugging purposes, returns a pretty-printed string of the given points.
pub(crate) fn pretty_print_points(
location_map: &DenseLocationMap,
points: impl IntoIterator<Item = PointIndex>,
) -> String {
pretty_print_region_elements(
points.into_iter().map(|p| location_map.to_location(p)).map(RegionElement::Location),
)
}

/// For debugging purposes, returns a pretty-printed string of the given region elements.
fn pretty_print_region_elements<'tcx>(
elements: impl IntoIterator<Item = RegionElement<'tcx>>,
Expand Down
20 changes: 19 additions & 1 deletion compiler/rustc_borrowck/src/type_check/liveness/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
use itertools::{Either, Itertools};
use rustc_data_structures::fx::FxHashSet;
use rustc_index::interval::IntervalSet;
use rustc_middle::mir::visit::{TyContext, Visitor};
use rustc_middle::mir::{Body, Local, Location, SourceInfo};
use rustc_middle::ty::relate::Relate;
use rustc_middle::ty::{GenericArgsRef, Region, RegionVid, Ty, TyCtxt, TypeVisitable};
use rustc_mir_dataflow::move_paths::MoveData;
use rustc_mir_dataflow::points::DenseLocationMap;
use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex};
use rustc_span::span_bug;
use rustc_trait_selection::traits::outlives_for_liveness::FreeRegionsVisitor;
use tracing::debug;

use super::TypeChecker;
use crate::BorrowckInferCtxt;
use crate::constraints::OutlivesConstraintSet;
use crate::polonius::{PoloniusContext, record_live_region_variance};
use crate::region_infer::values::LivenessValues;
Expand Down Expand Up @@ -229,3 +232,18 @@ impl<'a, 'tcx> LiveVariablesVisitor<'a, 'tcx> {
}
}
}

pub(crate) fn make_all_regions_live<'tcx>(
infcx: &BorrowckInferCtxt<'tcx>,
universal_regions: &UniversalRegions<'tcx>,
liveness: &mut LivenessValues,
value: impl TypeVisitable<TyCtxt<'tcx>>,
live_at: &IntervalSet<PointIndex>,
) {
debug!("make_all_regions_live(value={value:?})");
value.visit_with(&mut FreeRegionsVisitor {
tcx: infcx.tcx,
param_env: infcx.param_env,
op: |r| liveness.add_points(universal_regions.to_region_vid(r), live_at),
});
}
Loading
Loading