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

Unhelpful error when array elements aren't separated by commas #92089

Closed
adamchalmers opened this issue Dec 18, 2021 · 4 comments · Fixed by #92963
Closed

Unhelpful error when array elements aren't separated by commas #92089

adamchalmers opened this issue Dec 18, 2021 · 4 comments · Fixed by #92963
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@adamchalmers
Copy link

adamchalmers commented Dec 18, 2021

Given the following code (playground):

fn main() {
    let all_tests = [
        ("C200B40A82", 3)
        ("C200B40A82", 3)
    ];
}

The current output is:

error[E0618]: expected function, found `(&'static str, {integer})`
 --> src/main.rs:3:9
  |
3 |           ("C200B40A82", 3)
  |  _________-^^^^^^^^^^^^^^^^
4 | |         ("C200B40A82", 3)
  | |_________________________- call expression requires function

For more information about this error, try `rustc --explain E0618`.
error: could not compile `playground` due to previous error

Ideally the output should look like:

Items in arrays, vec![] or tuples need to be separated by commas

and the compiler would preview the fix, by adding the commas in green.

@adamchalmers adamchalmers added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 18, 2021
@hkmatsumoto
Copy link
Member

@rustbot claim

@hkmatsumoto
Copy link
Member

This week I'm busier than I thought ;)
@rustbot release-assignment

@BGR360
Copy link
Contributor

BGR360 commented Dec 27, 2021

@rustbot label +A-parser

@rustbot rustbot added the A-parser Area: The parsing of Rust source code to an AST. label Dec 27, 2021
@terrarier2111
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants