add regions_that_outlive to FreeRegionMap

This commit is contained in:
Niko Matsakis 2017-10-30 04:49:13 -04:00
parent 3db1a95a3f
commit 87c0c32768

View file

@ -182,6 +182,19 @@ impl<'tcx> FreeRegionMap<'tcx> {
debug!("lub_free_regions(r_a={:?}, r_b={:?}) = {:?}", r_a, r_b, result);
result
}
/// Returns all regions that are known to outlive `r_a`. For
/// example, in a function:
///
/// ```
/// fn foo<'a, 'b: 'a, 'c: 'b>() { .. }
/// ```
///
/// if `r_a` represents `'a`, this function would return `{'b, 'c}`.
pub fn regions_that_outlive<'a, 'gcx>(&self, r_a: Region<'tcx>) -> Vec<&Region<'tcx>> {
assert!(is_free(r_a));
self.relation.greater_than(&r_a)
}
}
fn is_free(r: Region) -> bool {