Closed
Description
The following incorrect code produces an incorrect diagnostic
#![feature(min_const_generics)]
struct Foo<const SET: bool>;
impl Foo<const SET: bool> {
fn set_bar() -> Foo<true> {
Foo
}
}
The diagnostic produced is:
error: expected one of `>`, const, lifetime, or type, found keyword `const`
--> src/lib.rs:5:10
|
5 | impl Foo<const SET: bool> {
| ^^^^^ expected one of `>`, const, lifetime, or type
Confusingly const
is shown as one of the expected items to replace const
.
Of course, the user most likely meant to type:
impl <const SET: bool> Foo<SET> {
Here's a playground reproducing the issue for convenience: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=27ae1b8286d97da1df8240f84062a339
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTCategory: This is a bug.`#![feature(const_generics)]`Relevant to the compiler team, which will review and decide on the PR/issue.An error is correctly emitted, but is confusing, for `min_const_generics`.