Skip to content

Commit 87c0c32

Browse files
committed
add regions_that_outlive to FreeRegionMap
1 parent 3db1a95 commit 87c0c32

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/librustc/middle/free_region.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,19 @@ impl<'tcx> FreeRegionMap<'tcx> {
182182
debug!("lub_free_regions(r_a={:?}, r_b={:?}) = {:?}", r_a, r_b, result);
183183
result
184184
}
185+
186+
/// Returns all regions that are known to outlive `r_a`. For
187+
/// example, in a function:
188+
///
189+
/// ```
190+
/// fn foo<'a, 'b: 'a, 'c: 'b>() { .. }
191+
/// ```
192+
///
193+
/// if `r_a` represents `'a`, this function would return `{'b, 'c}`.
194+
pub fn regions_that_outlive<'a, 'gcx>(&self, r_a: Region<'tcx>) -> Vec<&Region<'tcx>> {
195+
assert!(is_free(r_a));
196+
self.relation.greater_than(&r_a)
197+
}
185198
}
186199

187200
fn is_free(r: Region) -> bool {

0 commit comments

Comments
 (0)