How to pass optional metavariable to another macro-rules macro inside list expansion?

The full macro:

$(#[$StructMeta:meta])*
$Vis:vis struct $StructName:ident $(<$OwnerLifetime:lifetime>)? {
    owner: $Owner:ty,

    #[$Covariance:ident]
    dependent: $Dependent:ident,
}

$(impl {$($AutomaticDerive:ident),*})?

The relevant parts for this question:

$(<$OwnerLifetime:lifetime>)?
[...]
$(impl {$($AutomaticDerive:ident),*})?


// The user has to choose which traits can and should be automatically
// implemented for the cell.
$($(
    $crate::_impl_automatic_derive!($AutomaticDerive, $StructName $OwnerLifetime*);
)*)*


macro_rules! _impl_automatic_derive {
    (Debug, $StructName:ident $(, $OwnerLifetime:lifetime)?) => {
[...]

How could I pass the optional $OwnerLifetime to _impl_automatic_derive?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.