Skip to content

Cannot generate tuple-accession-syntax through macros #19630

@qrlpx

Description

@qrlpx

E.g. mytuple.0 can't be generated by mytuple.$num due to rust only accepting an identifier here. And digits ofc are expressions....

Minimal Example:

#![feature(macro_rules)]

macro_rules! nth(
    ($n:expr,$x:ident) => ($x.$n);
)

fn main(){
    let foo = (2u, 3u, 4u);
    let bar = nth!(2, foo);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions