Skip to content

Error suggests acessing tuple element on () type #110091

Closed
@fintelia

Description

@fintelia

Code

fn main() {
    let x = ();
    println!("{}", x[0])
}

Current output

error[E0608]: cannot index into a value of type `()`
 --> src/main.rs:3:20
  |
3 |     println!("{}", x[0])
  |                    ^^^^ help: to access tuple elements, use: `x.0`

Desired output

No response

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions