Skip to content

macro ident matcher + field notation = "missing match arm" #12107

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

Closed
digama0 opened this issue Apr 28, 2022 · 1 comment · Fixed by #12149
Closed

macro ident matcher + field notation = "missing match arm" #12107

digama0 opened this issue Apr 28, 2022 · 1 comment · Fixed by #12149

Comments

@digama0
Copy link
Contributor

digama0 commented Apr 28, 2022

pub struct Foo {
    field: (),
}
pub fn test(x: (Foo,)) {
    macro_rules! mac {
        ($field:ident) => {
            match x.0.$field {
                () => {}
            }
        };
    }
    mac!(field); // missing match arm
}
fn main() {}

Some observations:

  • Using x.0 .$field instead of x.0.$field makes the error go away, which suggests that 0. is getting parsed as a float literal (I have seen this issue before enough times to know not to write x.0.0, but some cursory rustc testing suggests that this isn't actually a problem anymore? Or maybe it was an RA problem all along...)
  • Using x.0.field works fine

rust-analyzer version: 241b9f9ae 2022-04-28 nightly

rustc version: rustc 1.62.0-nightly (69a5d2481 2022-04-27)

@digama0 digama0 changed the title Regression: macro ident matcher + field notation = "missing match arm" macro ident matcher + field notation = "missing match arm" Apr 28, 2022
digama0 added a commit to digama0/mm0 that referenced this issue Apr 28, 2022
@flodiebold
Copy link
Member

Probably duplicate of #1109.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants