Skip to content

unhygienic named labels allowed in macros #9171

Closed
@metajack

Description

@metajack

Hygiene currently prevents capturing variables but does not prevent you from capturing named labels.

For example:

fn main() {
    macro_rules! breakme(
        ($value: expr) => {
            break 'foo;
        }
    )
    'foo: loop { 
        breakme!("foo");
    }
}

Note, this currently causes a bus error in rustc, but probably otherwise works, and used to work before let hygiene was added.

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