pub struct UnitParen {
pub open: LParenTok,
pub close: RParenTok,
}Expand description
Unparse for an EMPTY group used as an ordinary field rather than as the
target of a #[group(self.x)] — PatBot::Unit { paren: ParenGroup<()> }
and its three siblings, which spell () with nothing inside.
syan core has a generic Parse for Group<T, O, C> but no generic
Unparse: the only Unparse for Group<..> impls there are the
proc_macro2 ones, where a delimited group is a single TokenTree rather
than three atoms. A #[group(..)] holder never needs it (it is emitted
through GroupUnparse::unparse_group), so the gap only shows up for a
holder standing alone as a field, where #[derive(Unparse)] synthesizes an
ordinary FieldTy: Unparse<Atom> predicate.
Hence a local node rather than an impl Unparse<Atom> for ParenGroup<()>:
Atom is syan::span::WithSpan<Token, Span>, an alias for a FOREIGN type,
so nothing in that impl would be local and the orphan rule rejects it
(E0117). The fields keep Group’s open/close names, the derived
Parse is the same two-token sequence Group’s generic Parse produces,
and the delimiters emit in source order, so parse . unparse still
round-trips.
Fields§
§open: LParenTok§close: RParenTokTrait Implementations§
Source§impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for UnitParen
impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for UnitParen
Source§type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
<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.