Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --I tried simplifying my code, but the code is quite complex and I wasn't able to recreate the ICE. Here is the repo which you can try building to see it for yourself: The main source of the issue is my Tensor structs which look similar to the below code. I have had issues with this . The ICE started happening after I convolution with fft. I to simplify writing the types. Maybe it's related? Sorry for the code mess; I didn't plan to show this code to other people. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Please add A-const-generics, F-constevaluatablechecked, and F-const_generics labels
Maybe related to , but I had this ICE already all the way back in 04/06/2021. Back then the error was
Smaller repro of ICE:
confirming potentially predates 1.56 nightly

Discussion:
| DefKind::AnonConst | DefKind::OpaqueTy | DefKind::Impl <ins> | DefKind::Field | DefKind::TyParam </ins> | DefKind::Closure | DefKind::Generator => true, DefKind::Mod <del> | DefKind::Field </del> | DefKind::ForeignMod <del> | DefKind::TyParam </del> | DefKind::ConstParam | DefKind::Macro(..) | DefKind::Use

<ins> #![feature(const_generics, const_evaluatable_checked)] #![allow(incomplete_features)] // library portion of regression test for #87674 pub struct Foo<const N: usize>([(); N + 1]) where [(); N + 1]: ; // library portion of regression test for #87603 pub struct S<T: Copy + Default, const N: usize> where [T; N * 2]: Sized, { pub s: [T; N * 2], } impl<T: Default + Copy, const N: usize> S<T, N> where [T; N * 2]: Sized, { pub fn test() -> Self { S { s: [T::default(); N * 2] } } } </ins>

<ins> #![feature(const_generics, const_evaluatable_checked)] #![allow(incomplete_features)] // library portion of testing that `impl Trait<{ expr }>` doesnt // ice because of a `DefKind::TyParam` parent pub fn foo<const N: usize>(foo: impl Into<[(); N + 1]>) { foo.into(); } </ins>

<ins> // aux-build:generics_of_parent.rs // check-pass #![feature(const_generics, const_evaluatable_checked)] #![allow(incomplete_features)] extern crate generics_of_parent; use generics_of_parent::{Foo, S}; fn main() { // regression test for #87603 const N: usize = 2; let x: S<u8, N> = S::test(); } // regression test for #87674 fn new<U>(a: U) -> U { a } fn foo<const N: usize>(bar: &mut Foo<N>) where [(); N + 1]: , { *bar = new(loop {}); } </ins>

<ins> // aux-build:generics_of_parent_impl_trait.rs #![feature(const_generics, const_evaluatable_checked)] #![allow(incomplete_features)] extern crate generics_of_parent_impl_trait; fn main() { // check for `impl Trait<{ const }>` which has a parent of a `DefKind::TyParam` generics_of_parent_impl_trait::foo([()]); //~^ error: type annotations needed: } </ins>

<ins> error[E0284]: type annotations needed: cannot satisfy `the constant `foo::{opaque#0}::{constant#0}` can be evaluated` --> $DIR/parent_generics_of_encoding_impl_trait.rs:9:5 | LL |     generics_of_parent_impl_trait::foo([()]); |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `foo::{opaque#0}::{constant#0}` can be evaluated` | ::: $DIR/auxiliary/generics_of_parent_impl_trait.rs:6:48 | LL | pub fn foo<const N: usize>(foo: impl Into<[(); N + 1]>) { |                                                ----- required by this bound in `foo` error: aborting due to previous error For more information about this error, try `rustc --explain E0284`. </ins>