]> git.proxmox.com Git - rustc.git/blame - src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / const-generics / generic_const_exprs / nested_uneval_unification-1.rs
CommitLineData
5869c6ff 1// run-pass
94222f64 2#![feature(generic_const_exprs)]
5869c6ff
XL
3#![allow(incomplete_features)]
4
5fn zero_init<const N: usize>() -> Substs1<N>
6where
7 [u8; N + 1]: ,
8{
9 Substs1([0; N + 1])
10}
11struct Substs1<const N: usize>([u8; N + 1])
12where
13 [(); N + 1]: ;
14
15fn substs2<const M: usize>() -> Substs1<{ M * 2 }>
16where
17 [(); { M * 2 } + 1]: ,
18{
19 zero_init::<{ M * 2 }>()
20}
21
22fn substs3<const L: usize>() -> Substs1<{ (L - 1) * 2 }>
23where
24 [(); (L - 1) * 2 + 1]: ,
25{
26 substs2::<{ L - 1 }>()
27}
28
29fn 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``