Skip to content

Hygiene problem in nested macros using ":pat" bindings #15221

@jbclements

Description

@jbclements

A nested macro expansion using :pat bindings is getting expanded into something where
a binding doesn't capture a varref that it should. Here's the code:

#![feature(macro_rules)]

macro_rules! inner_bind (
    ( $p:pat, $id:ident) => ({let $p = 13; $id}))

macro_rules! outer_bind (
    ($p:pat, $id:ident ) => (inner_bind!($p, $id)))

fn main() {
        outer_bind!(g1,g1);
}

Working on this now...

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions