]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/issues/issue-82956.rs
Auto merge of #94515 - estebank:tweak-move-error, r=davidtwco
[rust.git] / src / test / ui / const-generics / issues / issue-82956.rs
1 #![feature(generic_const_exprs)]
2 #![allow(incomplete_features)]
3
4 pub struct ConstCheck<const CHECK: bool>;
5
6 pub trait True {}
7 impl True for ConstCheck<true> {}
8
9 pub trait OrdesDec {
10     type Newlen;
11     type Output;
12
13     fn pop(self) -> (Self::Newlen, Self::Output);
14 }
15
16 impl<T, const N: usize> OrdesDec for [T; N]
17 where
18     ConstCheck<{N > 1}>: True,
19     [T; N - 1]: Sized,
20 {
21     type Newlen = [T; N - 1];
22     type Output = T;
23
24     fn pop(self) -> (Self::Newlen, Self::Output) {
25         let mut iter = IntoIter::new(self);
26         //~^ ERROR: failed to resolve: use of undeclared type `IntoIter`
27         let end = iter.next_back().unwrap();
28         let new = [(); N - 1].map(move |()| iter.next().unwrap());
29         (new, end)
30     }
31 }
32
33 fn main() {}