Skip to content

Associated Types + Const Evaluatable Checked ICE #78246

Closed
@beepster4096

Description

@beepster4096

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

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-const-genericsArea: const generics (parameters and arguments)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`F-generic_const_exprs`#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions