Skip to content

Disable macro hygiene #2054

Closed
Closed
@jD91mZM2

Description

@jD91mZM2

Not sure how the best way to do it would be, but it would be awesome to be able to disable macro hygiene.

macro_rules! test {
    () => raw {
        val = 42;
    }
}

let mut val = 0;
test!();
// val = 3

This would be useful to create global macros that can still access local variables.
We should consider making you call the macro with two exclamation marks to really make sure you know you are calling a raw macro - though, you decide on that one. I'm personally against it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions