// issue: rust-lang/rust#106423 // ICE collection encountered polymorphic constant: UnevaluatedConst {..} //@ edition:2021 //@ check-pass #![feature(generic_const_exprs, generic_arg_infer)] #![allow(incomplete_features)] #![allow(unused)] use core::mem::MaybeUninit; pub struct Arr { v: [MaybeUninit; N], } impl Arr { const ELEM: MaybeUninit = MaybeUninit::uninit(); const INIT: [MaybeUninit; N] = [Self::ELEM; N]; // important for optimization of `new` fn new() -> Self { Arr { v: Self::INIT } } } pub struct BaFormatFilter {} pub enum DigitalFilter where [(); N * 2 + 1]: Sized, [(); N * 2]: Sized, { Ba(BaFormatFilter<{ N * 2 + 1 }>), } pub fn iirfilter_st_copy(_: [f32; M]) -> DigitalFilter where [(); N * 2 + 1]: Sized, [(); N * 2]: Sized, { let zpk = zpk2tf_st(&Arr::::new(), &Arr::::new()); DigitalFilter::Ba(zpk) } pub fn zpk2tf_st( _z: &Arr, _p: &Arr, ) -> BaFormatFilter<{ N + 1 }> where [(); N + 1]: Sized, { BaFormatFilter {} } fn main() { iirfilter_st_copy::<4, 2>([10., 50.,]); }