Provide const generics hints when a token is forgotten #84327
Labels
A-const-generics
Area: const generics (parameters and arguments)
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The lexing & parsing of Rust source code to an AST
const-generics-bad-diagnostics
An error is correctly emitted, but is confusing, for `min_const_generics`.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Ideally,
rustc
should 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:
: Type
usize
type, because that's the type ofN
in[T; N]
Similarly:
Produces:
Ideally the output should look like:
const
with a hintAnd:
Produces:
Ideally the output should look like:
const N: Type
usize
type, because that's the type ofN
in[T; N]
The text was updated successfully, but these errors were encountered: