diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-23 12:32:32 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-23 12:32:32 +0100 |
| commit | f8aeac8a3692b1a02002a1293c231de73149e676 (patch) | |
| tree | ad9f7a6e0493b636cbbffb665cd8155daf7b63be | |
| parent | f1f287fadb91451b116ff00a2f8b9c32c5e1571b (diff) | |
| download | rust-f8aeac8a3692b1a02002a1293c231de73149e676.tar.gz rust-f8aeac8a3692b1a02002a1293c231de73149e676.zip | |
add test for #106423
Fixes #106423
| -rw-r--r-- | tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs b/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs new file mode 100644 index 00000000000..ed5ba32b621 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs @@ -0,0 +1,57 @@ +// 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<T, const N: usize> { + v: [MaybeUninit<T>; N], +} + +impl<T, const N: usize> Arr<T, N> { + const ELEM: MaybeUninit<T> = MaybeUninit::uninit(); + const INIT: [MaybeUninit<T>; N] = [Self::ELEM; N]; // important for optimization of `new` + + fn new() -> Self { + Arr { v: Self::INIT } + } +} + +pub struct BaFormatFilter<const N: usize> {} + +pub enum DigitalFilter<const N: usize> +where + [(); N * 2 + 1]: Sized, + [(); N * 2]: Sized, +{ + Ba(BaFormatFilter<{ N * 2 + 1 }>), +} + +pub fn iirfilter_st_copy<const N: usize, const M: usize>(_: [f32; M]) -> DigitalFilter<N> +where + [(); N * 2 + 1]: Sized, + [(); N * 2]: Sized, +{ + let zpk = zpk2tf_st(&Arr::<f32, { N * 2 }>::new(), &Arr::<f32, { N * 2 }>::new()); + DigitalFilter::Ba(zpk) +} + +pub fn zpk2tf_st<const N: usize>( + _z: &Arr<f32, N>, + _p: &Arr<f32, N>, +) -> BaFormatFilter<{ N + 1 }> +where + [(); N + 1]: Sized, +{ + BaFormatFilter {} +} + + +fn main() { + iirfilter_st_copy::<4, 2>([10., 50.,]); +} |
