Trait rusttyc::types::ContextSensitiveVariant [−][src]
A Variant which requires a context for meet operations and equality checks.
See Variant for general information and requirements on the implementation. The context will ever only be borrowed without further requirements on it, in particular, it does not have to implement Clone.
Associated Types
type Err: Debug
[src]
Result of a meet of two incompatible type, i.e., it represents a type contradiction. May contain information regarding why the meet failed. The error will be wrapped into a crate::TcErr providing contextual information.
type Context: Debug
[src]
Represents the meet- and equality context.
Required methods
fn top() -> Self
[src]
Returns the unconstrained, most abstract type.
fn meet(
lhs: Partial<Self>,
rhs: Partial<Self>,
ctx: &Self::Context
) -> Result<Partial<Self>, Self::Err>
[src]
lhs: Partial<Self>,
rhs: Partial<Self>,
ctx: &Self::Context
) -> Result<Partial<Self>, Self::Err>
Attempts to meet two variants respecting their currently-determined potentially variable arity.
Refer to Variant for the responsibilities of this function.
In particular: usize::max(lhs.least_arity, rhs.least_arity) <= result.least_arity
In the successful case, the variant and arity of the partial have to match, i.e., if the Arity
is fixed with value n
, then Partial::least_arity needs to be n
as well.
fn arity(&self, ctx: &Self::Context) -> Arity
[src]
Indicates whether the variant has a fixed arity. Note that this values does not have to be constant over all instances of the variant. A tuple, for example, might have a variable arity until the inferrence reaches a point where it is determined to be a pair or a triple. The pair and triple are both represented by the same type variant and have a fixed, non-specific arity. Before obtaining this information, the tuple has a variable arity and potentially a different variant.
fn equal(this: &Self, that: &Self, ctx: &Self::Context) -> bool
[src]
Context-sensitive version of Eq. All rules apply.