pub macro __internal_remove_let {
    (
        {
            {
                $($already_parsed:tt)*
            }
            {
                let $var:ident $(: $ty:ty)? = $expr:expr;
                $($rest:tt)*
            }
        }
    ) => { ... },
    (
        {
            {
                $($already_parsed:tt)*
            }
            {
                let $var:ident $(: $ty:ty)? = const $block:block;
                $($rest:tt)*
            }
        }
    ) => { ... },
    (
        {
            {
                $($already_parsed:tt)*
            }
            {
                $stmt:stmt;
                $($rest:tt)*
            }
        }
    ) => { ... },
    (
        {
            {
                $($already_parsed:tt)*
            }
            {
                $expr:expr
            }
        }
    ) => { ... },
}
🔬This is a nightly-only experimental API. (custom_mir)
Expand description

Helper macro that removes the let declarations from a bunch of statements.

Because expression position macros cannot expand to statements + expressions, we need to be slightly creative here. The general strategy is also statement munching as above, but the output of the macro is “stored” in the subsequent macro invocation. Easiest understood via example:

invoke!(
    {
        {
            x = 5;
        }
        {
            let d = e;
            Call()
        }
    }
)

becomes

invoke!(
    {
        {
            x = 5;
            d = e;
        }
        {
            Call()
        }
    }
)