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

r#const sometimes does not match in declarative macros #18148

Closed
DaniPopes opened this issue Sep 19, 2024 · 2 comments · Fixed by #18153
Closed

r#const sometimes does not match in declarative macros #18148

DaniPopes opened this issue Sep 19, 2024 · 2 comments · Fixed by #18153
Assignees
Labels
C-bug Category: bug

Comments

@DaniPopes
Copy link
Contributor

DaniPopes commented Sep 19, 2024

rust-analyzer version: 0.3.2112-standalone

rustc version: rustc 1.83.0-nightly (0ee7cb5e3 2024-09-10)

editor or extension: VSCode 1.92.2

relevant settings: N/A

repository link (if public, optional): N/A

code snippet to reproduce:

pub fn r_hash_const() {
    let r#const = true;
    assert_eq!(r#const, true);
    //         ^^^^^^^ no rule matches input tokens

    // However, these work:
    assert!(r#const);
    assert!(r#const,);

    // Other keywords also work:
    let r#extern = true;
    assert_eq!(r#extern, true);
    let r#fn = true;
    assert_eq!(r#fn, true);
}
@DaniPopes DaniPopes added the C-bug Category: bug label Sep 19, 2024
@DaniPopes DaniPopes changed the title r#const sometimes does not match expr in declarative macros r#const sometimes does not match in declarative macros Sep 19, 2024
@ChayimFriedman2
Copy link
Contributor

ChayimFriedman2 commented Sep 19, 2024

Hmm... That's probably because expr_2021 doesn't match inline const, which starts with const.

Edit: No, this reproduces even on edition 2024.

@ChayimFriedman2
Copy link
Contributor

I'll look at this.

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
2 participants