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