-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Bad generic error for incorrectly placed where clause for tuple struct #100790
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: [playground]
The current output is:
What appears to be happening is that we're trying to parse this as a unit struct (which can have a
whereclause), and thus trying to parse the struct tuple as a type to bound.With a tuple visibility:
Ideally,
;instead of:(or a currently-just-for-diagnostics=) and then reinterpret the tuple type as a tuple struct tuple, printing a more useful error;pubvisibility marker and retry to parse as a tuple struct definition tuple in order to provide the nicer error.