Closed
Description
#![feature(const_generics)]
struct FakeArray<T, const N: usize>(T);
impl<T, const N: usize> FakeArray<T, { N }> {
fn len(&self) -> usize {
N
}
}
fn main() {
let fa = FakeArray::<{ 32 }>(1);
println!("{}", fa.len());
}
Errors:
Compiling playground v0.0.1 (/playground)
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> src/main.rs:1:12
|
1 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:553: failed to lift `QueryResponse { var_values: CanonicalVarValues { var_values: [^0, Const { ty: _, val: Infer(Canonical(DebruijnIndex(0), 1)) }] }, region_constraints: [], certainty: Proven, value: FakeArray<^0, _: _> }`, canonicalized from `QueryResponse { var_values: CanonicalVarValues { var_values: [{integer}, Const { ty: _, val: Infer(Var(_#0c)) }] }, region_constraints: [], certainty: Proven, value: FakeArray<{integer}, _: _> }`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:637:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.37.0-nightly (6ffb8f53e 2019-06-03) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(const_generics)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.