Struct rustc_data_structures::transitive_relation::TransitiveRelation [] [src]

pub struct TransitiveRelation<T: Debug + PartialEq> {
    // some fields omitted
}
Unstable (rustc_private)

Methods

impl<T: Debug + PartialEq> TransitiveRelation<T>
[src]

fn new() -> TransitiveRelation<T>

fn add(&mut self, a: T, b: T)

Unstable (rustc_private)

Indicate that a < b (where < is this relation)

fn contains(&self, a: &T, b: &T) -> bool

Unstable (rustc_private)

Check whether a < target (transitively)

fn postdom_upper_bound(&self, a: &T, b: &T) -> Option<&T>

Unstable (rustc_private)

Picks what I am referring to as the "postdominating" upper-bound for a and b. This is usually the least upper bound, but in cases where there is no single least upper bound, it is the "mutual immediate postdominator", if you imagine a graph where a < b means a -> b.

This function is needed because region inference currently requires that we produce a single "UB", and there is no best choice for the LUB. Rather than pick arbitrarily, I pick a less good, but predictable choice. This should help ensure that region inference yields predictable results (though it itself is not fully sufficient).

Examples are probably clearer than any prose I could write (there are corresponding tests below, btw). In each case, the query is postdom_upper_bound(a, b):

// returns Some(x), which is also LUB
a -> a1 -> x
           ^
           |
b -> b1 ---+

// returns Some(x), which is not LUB (there is none)
// diagonal edges run left-to-right
a -> a1 -> x
  \/       ^
  /\       |
b -> b1 ---+

// returns None
a -> a1
b -> b1

fn minimal_upper_bounds(&self, a: &T, b: &T) -> Vec<&T>

Unstable (rustc_private)

Returns the set of bounds X such that:

  • a < X and b < X
  • there is no Y != X such that a < Y and Y < X
    • except for the case where X < a (i.e., a strongly connected component in the graph). In that case, the smallest representative of the SCC is returned (as determined by the internal indices).

Note that this set can, in principle, have any size.

Trait Implementations

Derived Implementations

impl<T: Clone + Debug + PartialEq> Clone for TransitiveRelation<T>
[src]

fn clone(&self) -> TransitiveRelation<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more