pub struct PatCons {
pub head: PatBot,
pub tail: Vec<ConsSeg>,
}Expand description
pattr: a patbot, followed by any number of :: patbot segments.
parser.mly writes this as right recursion (patbot :: pattr, always
fine, unlike left recursion) but it is flattened to a Vec here (the
same right-fold-at-elaboration technique as OpChain, :: being
right-associative) so that PatCons need not be self-referential: a
PatCons/ConsRest pair of mutually-referencing wrapper structs
would form a 2-cycle with no self-loop of its own, which the
#[recurse] depth engine rejects (“a sub-cycle running entirely
through non-root types”).
Fields§
§head: PatBot§tail: Vec<ConsSeg>Trait Implementations§
Source§impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for PatCons
impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for PatCons
Source§type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
Every error must be convertible to the universal one, so a field’s failure can become the
enclosing type’s failure with no per-field where-predicate. Stating it HERE rather than at
each derived impl is what keeps it out of the obligation graph: a per-field
<FieldTy as Parse<Atom>>::Error: Into<…> predicate re-creates a projection cycle on a
recursive field (E0275), which decycle’s bound-peeling does not break.Source§fn parse_stream<__SyanMacro_S: ParseStream<Atom = __SyanMacro_Atom>>(
__syan_stream: &mut __SyanMacro_S,
) -> Result<Self, Self::Error>
fn parse_stream<__SyanMacro_S: ParseStream<Atom = __SyanMacro_Atom>>( __syan_stream: &mut __SyanMacro_S, ) -> Result<Self, Self::Error>
Parse from a reborrowable stream. Read more
impl StructuralPartialEq for PatCons
Auto Trait Implementations§
impl Freeze for PatCons
impl RefUnwindSafe for PatCons
impl Send for PatCons
impl Sync for PatCons
impl Unpin for PatCons
impl UnsafeUnpin for PatCons
impl UnwindSafe for PatCons
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
Mutably borrows from an owned value. Read more