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

The full macro:

$Vis:vis struct $StructName:ident $(<$OwnerLifetime:lifetime>)? {
    owner: $Owner:ty,

    dependent: $Dependent:ident,

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

The relevant parts for this question:

$(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.