Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-terminal `ident` should not match keywords #772

Closed
mzabaluev opened this Issue Jan 30, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@mzabaluev
Copy link
Contributor

mzabaluev commented Jan 30, 2015

This example macro is currently not usable:

macro_rules! idents_followed_by_keyword {
    ($($slot:ident,)+ else) => ($(let $slot = 0;)+);
}

fn main() {
    idents_followed_by_keyword!(_a, else);
}

The reason is that the ident format specifier makes no distinction between keywords and bona fide identifiers, resulting in ambiguity when the matcher meets else. As keywords cannot be used in place of identifiers in transcription, it should break no existing macro if ident is changed to exclude keywords.

This will permit more useful, cleaner macro syntaxes.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Jan 28, 2018

This works as expected and can't be changed now.
See rust-lang/rust#27899

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.