Closed
Description
I tried this code:
#![feature(const_generics)]
struct Foo<const N: usize>([(); N]);
fn main() {
let x: Foo<_> = Foo([]);
}
I only half-expected the code to compile, given where const generics is at (is inference of const generic arguments even intended to eventually work?), but the resulting error was pretty jarring:
error[E0107]: wrong number of const arguments: expected 1, found 0
--> src/main.rs:6:12
|
6 | let x: Foo<_> = Foo([]);
| ^^^^^^ expected 1 const argument
error[E0107]: wrong number of type arguments: expected 0, found 1
--> src/main.rs:6:16
|
6 | let x: Foo<_> = Foo([]);
| ^ unexpected type argument
Meta
rustc --version --verbose
:
1.44.0-nightly (2020-04-02 537ccdf3ac44c8c7a8d3)
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Area: Type inferenceArea: The lexing & parsing of Rust source code to an ASTArea: Type systemCategory: A feature request, i.e: not implemented / a PR.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.