Skip to content

Commit d4c6c77

Browse files
Xavier Denisxldenis
Xavier Denis
authored andcommitted
Make a minimal amount of region APIs public
1 parent 31e6e8c commit d4c6c77

File tree

1 file changed

+14
-5
lines changed
  • compiler/rustc_borrowck/src/region_infer

1 file changed

+14
-5
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -1328,14 +1328,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13281328
})
13291329
}
13301330

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

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

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

0 commit comments

Comments
 (0)