rename greater_than to reachable_from

This commit is contained in:
Niko Matsakis 2017-11-20 05:15:06 -05:00
parent 45f6027196
commit fb4b06ab3b
2 changed files with 3 additions and 15 deletions

View File

@ -73,19 +73,6 @@ 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) || *r_a == ty::ReStatic);
self.relation.greater_than(&r_a)
}
}
fn is_free(r: Region) -> bool {

View File

@ -134,12 +134,13 @@ impl<T: Clone + Debug + Eq + Hash + Clone> TransitiveRelation<T> {
}
}
/// Returns a vector of all things greater than `a`.
/// Thinking of `x R y` as an edge `x -> y` in a graph, this
/// returns all things reachable from `a`.
///
/// Really this probably ought to be `impl Iterator<Item=&T>`, but
/// I'm too lazy to make that work, and -- given the caching
/// strategy -- it'd be a touch tricky anyhow.
pub fn greater_than(&self, a: &T) -> Vec<&T> {
pub fn reachable_from(&self, a: &T) -> Vec<&T> {
match self.index(a) {
Some(a) => self.with_closure(|closure| {
closure.iter(a.0).map(|i| &self.elements[i]).collect()