Skip to content

Commit f8aeac8

Browse files
committed
1 parent f1f287f commit f8aeac8

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// issue: rust-lang/rust#106423
2+
// ICE collection encountered polymorphic constant: UnevaluatedConst {..}
3+
//@ edition:2021
4+
//@ check-pass
5+
6+
#![feature(generic_const_exprs, generic_arg_infer)]
7+
#![allow(incomplete_features)]
8+
#![allow(unused)]
9+
10+
use core::mem::MaybeUninit;
11+
12+
pub struct Arr<T, const N: usize> {
13+
v: [MaybeUninit<T>; N],
14+
}
15+
16+
impl<T, const N: usize> Arr<T, N> {
17+
const ELEM: MaybeUninit<T> = MaybeUninit::uninit();
18+
const INIT: [MaybeUninit<T>; N] = [Self::ELEM; N]; // important for optimization of `new`
19+
20+
fn new() -> Self {
21+
Arr { v: Self::INIT }
22+
}
23+
}
24+
25+
pub struct BaFormatFilter<const N: usize> {}
26+
27+
pub enum DigitalFilter<const N: usize>
28+
where
29+
[(); N * 2 + 1]: Sized,
30+
[(); N * 2]: Sized,
31+
{
32+
Ba(BaFormatFilter<{ N * 2 + 1 }>),
33+
}
34+
35+
pub fn iirfilter_st_copy<const N: usize, const M: usize>(_: [f32; M]) -> DigitalFilter<N>
36+
where
37+
[(); N * 2 + 1]: Sized,
38+
[(); N * 2]: Sized,
39+
{
40+
let zpk = zpk2tf_st(&Arr::<f32, { N * 2 }>::new(), &Arr::<f32, { N * 2 }>::new());
41+
DigitalFilter::Ba(zpk)
42+
}
43+
44+
pub fn zpk2tf_st<const N: usize>(
45+
_z: &Arr<f32, N>,
46+
_p: &Arr<f32, N>,
47+
) -> BaFormatFilter<{ N + 1 }>
48+
where
49+
[(); N + 1]: Sized,
50+
{
51+
BaFormatFilter {}
52+
}
53+
54+
55+
fn main() {
56+
iirfilter_st_copy::<4, 2>([10., 50.,]);
57+
}

0 commit comments

Comments
 (0)