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

$crate in macros is accepted in any identifier position #42898

Closed
petrochenkov opened this issue Jun 25, 2017 · 0 comments
Closed

$crate in macros is accepted in any identifier position #42898

petrochenkov opened this issue Jun 25, 2017 · 0 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The parsing of Rust source code to an AST regression-from-stable-to-stable Performance or correctness regression from one stable version to another.

Comments

@petrochenkov
Copy link
Contributor

petrochenkov commented Jun 25, 2017

E.g. this compiles on rustc 1.20.0-nightly (c9bb93576 2017-06-24)

macro_rules! m {
    () => {
        struct $crate {}
    }
}

m!();

fn main() {}

This is a regression from Rust 1.14.0.

$crate should be accepted only as a first segment in a path, so it would be reasonable to turn it from an "arbitrary identifier" into a "path segment keyword" like Self/self/super.

@petrochenkov petrochenkov added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The parsing of Rust source code to an AST regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Jun 25, 2017
bors added a commit that referenced this issue Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The parsing of Rust source code to an AST regression-from-stable-to-stable Performance or correctness regression from one stable version to another.
Projects
None yet
Development

No branches or pull requests

1 participant