-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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.
Description
This code
#![feature(const_generics)]
#[derive(Debug)]
struct X<const N: usize> {
a: [u32; N],
}
leads to
--> src/lib.rs:1:12
|
1 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
error[E0107]: wrong number of const arguments: expected 1, found 0
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `[type error]`,
right: `usize`', src/librustc/ty/sty.rs:2279:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0107`.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
It doesn't seem Debug
related, since the same happens for deriving Copy
.
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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
Projects
Milestone
Relationships
Development
Select code repository
Activity
hellow554 commentedon May 11, 2019
@rustbot modify labels: I-ICE C-Bug A-const-generics
HadrienG2 commentedon May 11, 2019
I strongly suspect this might be because the derive(Debug) macro implementation will copy-paste
N
everywhere, whereas the current const generics implementation requires using{N}
when instantiating a const generic type.varkor commentedon May 30, 2019
This now has only the
error[E0107]: wrong number of const arguments: expected 1, found 0
error, which is the same as #61346, so maybe a fix for one will also address the other.andreytkachenko commentedon Jun 5, 2019
Can confirm, in case:
compiler complain that
[T, _]
not derives Debug, what is expected because it does not exists incore
yet:Rollup merge of rust-lang#61570 - varkor:infer-const-arg, r=eddyb
Rollup merge of rust-lang#61570 - varkor:infer-const-arg, r=eddyb
Rollup merge of rust-lang#61570 - varkor:infer-const-arg, r=eddyb