Skip to content

Poor diagnostics for [T, N] turbofish instead of [T; N] #81097

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

Open
clarfonthey opened this issue Jan 16, 2021 · 1 comment
Open

Poor diagnostics for [T, N] turbofish instead of [T; N] #81097

clarfonthey opened this issue Jan 16, 2021 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@clarfonthey
Copy link
Contributor

clarfonthey commented Jan 16, 2021

Minimal example:

fn main() {
    drop::<[(), 0]>([]);
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error: unmatched angle bracket
 --> src/main.rs:2:11
  |
2 |     drop::<[(), 0]>([]);
  |           ^ help: remove extra angle bracket

error: expected one of `;` or `]`, found `,`
 --> src/main.rs:2:15
  |
2 |     drop::<[(), 0]>([]);
  |               ^ expected one of `;` or `]`

error: aborting due to 2 previous errors

error: could not compile `playground`

To learn more, run the command again with --verbose.

Here, there actually isn't an unmatched angle bracket; the issue is that [(), 0] isn't a type, and that it should be [(); 0]. There might be other cases where this mistake causes awkward errors that might need fixing too, but this is just what I found.

@clarfonthey clarfonthey changed the title Poor diagnostics for [T, N] turbofish Poor diagnostics for [T, N] turbofish instead of [T; N] Jan 16, 2021
@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 16, 2021
@camelid

This comment has been minimized.

@rustbot rustbot self-assigned this Feb 1, 2021
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 C-enhancement Category: An issue proposing an enhancement or a PR with one. 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.

4 participants