-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Provide const generics hints when a token is forgotten #84327
Copy link
Copy link
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)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 ASTD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.T-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.
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)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 ASTD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.T-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Ideally,
rustcshould guide the user towards producing const generics code, even if they forget theconst, the type, or both.Given the following code:
(All examples are in https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4a11f9dad9f8069e70f2aea6cb4084ad )
The current output is:
Ideally the output should look like:
: Typeusizetype, because that's the type ofNin[T; N]Similarly:
Produces:
Ideally the output should look like:
constwith a hintAnd:
Produces:
Ideally the output should look like:
const N: Typeusizetype, because that's the type ofNin[T; N]