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

Allow using $:literal containing integer to index into a tuple #91166

Closed
wants to merge 2 commits into from

Commits on Jan 19, 2022

  1. Add test for using $:literal to index a tuple

    Currently fails to build:
    
        error: unexpected token: `0`
          --> src/test/ui/macros/macro-interpolation.rs:19:16
           |
        LL |         $var . $field
           |                ^^^^^^
        ...
        LL |     let _ = field!(tuple.0);
           |             --------------- in this macro invocation
           |
           = note: this error originates in the macro `field` (in Nightly builds, run with -Z macro-backtrace for more info)
    
        error: macro expansion ignores token `0` and any following
          --> src/test/ui/macros/macro-interpolation.rs:19:16
           |
        LL |         $var . $field
           |                ^^^^^^
        ...
        LL |     let _ = field!(tuple.0);
           |             --------------- caused by the macro expansion here
           |
           = note: the usage of `field!` is likely invalid in expression context
    
        error: aborting due to 2 previous errors
    dtolnay committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    e2ba9d1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aadf994 View commit details
    Browse the repository at this point in the history