Skip to content

Don't require parentheses when accessing nested tuple #20287

Closed
@nstoddard

Description

@nstoddard

If you have a nested tuple like this:

let a = ((1u8, 2u8), (3u8, 4u8));

You can't access it like this:

println!("{}", a.1.1);

Instead, you have to do this:

println!("{}", (a.1).1);

I can't think of any good reason why the former shouldn't be allowed. Maybe rustc is parsing it as the number 1.1? It seems like it shouldn't be hard to fix, since the compiler is already able to suggest adding the parentheses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions