EqUnifyValue in rustc_data_structures::unify - Rust
Description: A convenient helper for unification values which must be equal or else an error occurs. For example, if you are unifying types in a simple functional language, this may be appropriate, since (e.g.) you can’t unify a type variable bound to `int` with one bound to `float` (but you can unify two type variables both bound to `int`).

Skip to main content

## EqUnifyValue

# Trait EqUnifyValue

Source

    pub trait EqUnifyValue:
        Eq
        + Clone
        + Debug { }

Expand description

A convenient helper for unification values which must be equal or else an error occurs. For example, if you are unifying types in a simple functional language, this may be appropriate, since (e.g.) you can’t unify a type variable bound to `int` with one bound to `float` (but you can unify two type variables both bound to `int`).

Any type which implements `EqUnifyValue` automatially implements `UnifyValue`; if the two values are equal, merging is permitted. Otherwise, the error `(v1, v2)` is returned, where `v1` and `v2` are the two unequal values.

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementors§