]>
Commit | Line | Data |
---|---|---|
5869c6ff | 1 | // run-pass |
94222f64 | 2 | #![feature(generic_const_exprs)] |
5869c6ff XL |
3 | #![allow(incomplete_features)] |
4 | ||
5 | fn zero_init<const N: usize>() -> Substs1<N> | |
6 | where | |
7 | [u8; N + 1]: , | |
8 | { | |
9 | Substs1([0; N + 1]) | |
10 | } | |
11 | struct Substs1<const N: usize>([u8; N + 1]) | |
12 | where | |
13 | [(); N + 1]: ; | |
14 | ||
15 | fn substs2<const M: usize>() -> Substs1<{ M * 2 }> | |
16 | where | |
17 | [(); { M * 2 } + 1]: , | |
18 | { | |
19 | zero_init::<{ M * 2 }>() | |
20 | } | |
21 | ||
22 | fn substs3<const L: usize>() -> Substs1<{ (L - 1) * 2 }> | |
23 | where | |
24 | [(); (L - 1) * 2 + 1]: , | |
25 | { | |
26 | substs2::<{ L - 1 }>() | |
27 | } | |
28 | ||
29 | fn main() { | |
30 | assert_eq!(substs3::<2>().0, [0; 3]); | |
31 | } | |
32 | ||
33 | // Test that the ``{ (L - 1) * 2 + 1 }`` bound on ``substs3`` satisfies the | |
34 | // ``{ N + 1 }`` bound on ``Substs1`` |