Skip to content

Syntax: ignoring tuple index with a suffix (a.1lolololol) #59418

Description

@kpp
fn main() {
    let a = (1, 2, 3);
    println!("{}", a.1lolololol);
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4280ded6698f9f9f3877ad0498769cb7

Expected:

ERROR: tuple index with a suffix is invalid

Got:

Output: 2\n

All thanks to: https://linuxrocks.online/@carl/101569506337640753

UPD:

The same error arises with tuple struct:

struct X(i32,i32,i32);

fn main() {
    let a = X(1, 2, 3);
    let b = a.1lolololol;
    println!("{}", b);
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ad7f39e8edad0d98f2919bd4fdfded30

Expected:

ERROR: tuple index with a suffix is invalid

Got:

Output: 2\n

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions