Closed
Description
Code
#![feature(const_generics, const_evaluatable_checked)]
pub trait Ice {
type Array;
fn into_bytes(self) -> Self::Array;
}
impl<T: Ice, const N: usize> Ice for [T; N] where
[(); std::mem::size_of::<T::Array>() * N]:
{
type Array = [(); std::mem::size_of::<T::Array>() * N];
fn into_bytes(self) -> Self::Array {}
}
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (31530e5d1 2020-10-20)
binary: rustc
commit-hash: 31530e5d132ebcc3654baf2e5460599681520af0
commit-date: 2020-10-20
host: x86_64-pc-windows-msvc
release: 1.49.0-nightly
LLVM version: 11.0
Error output
error: internal compiler error: compiler\rustc_traits\src\normalize_erasing_regions.rs:37:32: could not fully normalize `Const { ty: fn() -> usize {std::mem::size_of::<<T as Ice>::Array>}, val: Value(Scalar(<ZST>)) }`
thread 'rustc' panicked at 'Box<Any>', compiler\rustc_errors\src\lib.rs:945: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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.49.0-nightly (31530e5d1 2020-10-20) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `std::mem::size_of::<<T as Ice>::Array>`
#1 [eval_to_allocation_raw] const-evaluating + checking `<[T; N] as Ice>::Array::{constant#0}`
end of query stack
Backtrace
error: internal compiler error: compiler\rustc_traits\src\normalize_erasing_regions.rs:37:32: could not fully normalize `Const { ty: fn() -> usize {std::mem::size_of::<<T as Ice>::Array>}, val: Value(Scalar(<ZST>)) }`
thread 'rustc' panicked at 'Box<Any>', compiler\rustc_errors\src\lib.rs:945:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.49.0-nightly (31530e5d1 2020-10-20) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `std::mem::size_of::<<T as Ice>::Array>`
#1 [eval_to_allocation_raw] const-evaluating + checking `<[T; N] as Ice>::Array::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `<[T; N] as Ice>::Array::{constant#0}`
#3 [eval_to_const_value_raw] simplifying constant for the type system `<[T; N] as Ice>::Array::{constant#0}`
#4 [typeck] type-checking `<[T; N] as Ice>::into_bytes`
#5 [typeck_item_bodies] type-checking all item bodies
#6 [analysis] running analysis passes on this crate
end of query stack
I think I'm an ICE magnet; this is my fourth one.
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Area: const generics (parameters and arguments)Area: Trait systemCategory: This is a bug.`#![feature(const_generics)]``#![feature(generic_const_exprs)]`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.This issue requires a nightly compiler in some way.