Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a minimal amount of region APIs public #124893

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,14 +1328,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
})
}

// Evaluate whether `sup_region == sub_region`.
fn eval_equal(&self, r1: RegionVid, r2: RegionVid) -> bool {
/// Evaluate whether `sup_region == sub_region`.
///
/// Panics if called before `solve()` executes,
// This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
pub fn eval_equal(&self, r1: RegionVid, r2: RegionVid) -> bool {
self.eval_outlives(r1, r2) && self.eval_outlives(r2, r1)
}

// Evaluate whether `sup_region: sub_region`.
/// Evaluate whether `sup_region: sub_region`.
///
/// Panics if called before `solve()` executes,
// This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
#[instrument(skip(self), level = "debug", ret)]
fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
pub fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
debug!(
"sup_region's value = {:?} universal={:?}",
self.region_value_str(sup_region),
Expand Down Expand Up @@ -2248,7 +2254,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
}

/// Access to the SCC constraint graph.
pub(crate) fn constraint_sccs(&self) -> &Sccs<RegionVid, ConstraintSccIndex> {
/// This can be used to quickly under-approximate the regions which are equal to each other
/// and their relative orderings.
// This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
pub fn constraint_sccs(&self) -> &Sccs<RegionVid, ConstraintSccIndex> {
self.constraint_sccs.as_ref()
}

Expand Down