pub enum CaseForm {
Expression,
Parameter,
}Expand description
What the source wrote that a Case term was built from.
A parameter written as a pattern — first (x, _) = x — is a match like any other,
and it is translated as one: the parameter becomes a plain one named by
pattern_parameter, and the declaration’s body a single-branch Case on it. So a
backend lowers a pattern in either position the same way, and the term language keeps
one binding construct, TermKind::Fun, that only ever binds a name.
This is what lets a diagnostic about the match speak about what the user wrote: a
type error in a parameter’s pattern names the parameter and not a case, one in the
body under it names the declaration’s body and not a case branch, and a
backend refusing the match can say which of the two it is refusing.
Variants§
Expression
A case … of expression.
Parameter
A parameter the declaration wrote as a pattern. The Case has exactly one
branch, and its scrutinee is the local reference pattern_parameter names.
Trait Implementations§
impl Copy for CaseForm
impl Eq for CaseForm
impl StructuralPartialEq for CaseForm
Auto Trait Implementations§
impl Freeze for CaseForm
impl RefUnwindSafe for CaseForm
impl Send for CaseForm
impl Sync for CaseForm
impl Unpin for CaseForm
impl UnsafeUnpin for CaseForm
impl UnwindSafe for CaseForm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.