ICE on unmonomorphized const generics in const eval: eval_const_to_op: Unexpected ConstKind #72819
Closed
Description
Amusingly the following ICEs while https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=67ee1b8218865042e272d1c2c1aa22fe has a compiler error that hints at the const generic actually getting resolved.
#![feature(const_generics)]
#![allow(incomplete_features)]
struct Arr<const N: usize>
where Assert::<{N < usize::max_value() / 2}>: IsTrue,
{
}
enum Assert<const CHECK: bool> {}
trait IsTrue {}
impl IsTrue for Assert<true> {}
fn main() {
let x: Arr<{usize::max_value()}> = Arr {};
}
Errors:
Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_mir/interpret/operand.rs:548: eval_const_to_op: Unexpected ConstKind Const { ty: usize, val: Bound(DebruijnIndex(0), 0) }
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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.45.0-nightly (74e804683 2020-05-30) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: aborting due to previous error
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Area: const generics (parameters and arguments)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![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.ICE tracked in rust-lang/glacier.
Activity