[−]Trait rustc_data_structures::unify::UnifyValue
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Trait implemented for values associated with a unification key. This trait defines how to merge the values from two keys that are unioned together. This merging can be fallible. If you attempt to union two keys whose values cannot be merged, then the error is propagated up and the two keys are not unioned.
This crate provides implementations of UnifyValue
for ()
(which is infallible) and Option<T>
(where T: UnifyValue
). The
option implementation merges two sum-values using the UnifyValue
implementation of T
.
See also EqUnifyValue
, which is a convenience trait for cases
where the "merge" operation succeeds only if the two values are
equal.
Associated Types
type Error
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Defines the type to return when merging of two values fails.
If merging is infallible, use the special struct NoError
found in this crate, which unlocks various more convenient
methods on the unification table.
Required Methods
fn unify_values(value1: &Self, value2: &Self) -> Result<Self, Self::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given two values, produce a new value that combines them. If that is not possible, produce an error.
Implementations on Foreign Types
impl<V> UnifyValue for Option<V> where
V: UnifyValue,
impl<V> UnifyValue for Option<V> where
V: UnifyValue,
type Error = <V as UnifyValue>::Error
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_values(
a: &Option<V>,
b: &Option<V>
) -> Result<Option<V>, <V as UnifyValue>::Error>
fn unify_values(
a: &Option<V>,
b: &Option<V>
) -> Result<Option<V>, <V as UnifyValue>::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
impl UnifyValue for ()
impl UnifyValue for ()
type Error = NoError
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_values(&(), &()) -> Result<(), NoError>
fn unify_values(&(), &()) -> Result<(), NoError>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Implementors
impl<T> UnifyValue for T where
T: EqUnifyValue,
impl<T> UnifyValue for T where
T: EqUnifyValue,
type Error = (T, T)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn unify_values(value1: &T, value2: &T) -> Result<T, <T as UnifyValue>::Error>
fn unify_values(value1: &T, value2: &T) -> Result<T, <T as UnifyValue>::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?