Struct rustc_trans::middle::infer::unify::UnificationTableExperimental [-]  [+] [src]

pub struct UnificationTable<K, V> {
    // some fields omitted
}

Table of unification keys and their values.

Methods

impl<'tcx, V: Repr<'tcx> + PartialEq<V> + Clone, K: UnifyKey<'tcx, V>> UnificationTable<K, V>

fn new() -> UnificationTable<K, V>

fn snapshot(&mut self) -> Snapshot<K>

Starts a new snapshot. Each snapshot must be either rolled back or committed in a "LIFO" (stack) order.

fn rollback_to(&mut self, snapshot: Snapshot<K>)

Reverses all changes since the last snapshot. Also removes any keys that have been created since then.

fn commit(&mut self, snapshot: Snapshot<K>)

Commits all changes since the last snapshot. Of course, they can still be undone if there is a snapshot further out.

fn new_key(&mut self, value: V) -> K

fn get(&mut self, tcx: &ctxt, vid: K) -> Node<K, V>

Find the root node for vid. This uses the standard union-find algorithm with path compression: http://en.wikipedia.org/wiki/Disjoint-set_data_structure

fn set(&mut self, tcx: &ctxt<'tcx>, key: K, new_value: VarValue<K, V>)

Sets the value for vid to new_value. vid MUST be a root node! Also, we must be in the middle of a snapshot.

fn unify(&mut self, tcx: &ctxt<'tcx>, node_a: &Node<K, V>, node_b: &Node<K, V>) -> (K, uint)

Either redirects node_a to node_b or vice versa, depending on the relative rank. Returns the new root and rank. You should then update the value of the new root to something suitable.