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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Tests for the lt_list module's api.
//!
//! The lt_list module is all type level constructs so the tests in
//! this module may look very strange.
/*
use std::panic::{RefUnwindSafe, UnwindSafe};
use supply::lt_list::*;
// LtList
const _: () = {
// LtList must not be object safe.
trait AssertSuper: Sized + Send + Sync + Unpin + RefUnwindSafe + UnwindSafe {}
#[allow(clippy::needless_maybe_sized)]
impl<L: ?Sized + LtList> AssertSuper for L {}
fn with_l<L: LtList>() {
// The tail of a list is always a list.
fn assert_head<T: Sized + Send + Sync + Unpin + RefUnwindSafe + UnwindSafe>() {}
assert_head::<L::Head>();
// The tail of a list is always a list.
fn assert_list<T: LtList>() {}
assert_list::<L::Tail>();
// Lt has a head of 'a and a tail of something.
fn assert_chain<'a, T: LtList<Head = Lt1<'a>, Tail = L>, L: LtList>() {}
assert_chain::<Lt<'_, L>, L>();
}
fn assert() {
// () has a head of 'static and a tail of itself.
fn assert_base<T: LtList<Head = Lt1<'static>, Tail = ()>>() {}
// assert_base::<()>();
}
};
// Lt
const _: () = {
fn _with_t<L: LtList>() {
// Static always implements all the auto traits.
fn assert_auto<T: Send + Sync + Unpin + RefUnwindSafe + UnwindSafe + Sized>() {}
assert_auto::<Lt<L>>();
}
// Lt's LtList properties are tested above.
};
// LtX
const _: () = {
#[allow(clippy::extra_unused_lifetimes)]
fn with_t<'l0, 'l1, 'l2, 'l3, 'l4, 'l5, L: LtList>() {
fn assert<T: Is<U>, U>() {}
assert::<Lt0, ()>();
assert::<Lt0<L>, L>();
assert::<Lt1<'l0>, Lt<'l0, ()>>();
assert::<Lt1<'l0, L>, Lt<'l0, L>>();
assert::<Lt2<'l0, 'l1>, Lt<'l0, Lt<'l1, ()>>>();
assert::<Lt2<'l0, 'l1, L>, Lt<'l0, Lt<'l1, L>>>();
assert::<Lt3<'l0, 'l1, 'l2>, Lt<'l0, Lt<'l1, Lt<'l2, ()>>>>();
assert::<Lt3<'l0, 'l1, 'l2, L>, Lt<'l0, Lt<'l1, Lt<'l2, L>>>>();
assert::<Lt4<'l0, 'l1, 'l2, 'l3>, Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, ()>>>>>();
assert::<Lt4<'l0, 'l1, 'l2, 'l3, L>, Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, L>>>>>();
assert::<Lt5<'l0, 'l1, 'l2, 'l3, 'l4>, Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, Lt<'l4, ()>>>>>>();
assert::<Lt5<'l0, 'l1, 'l2, 'l3, 'l4, L>, Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, Lt<'l4, L>>>>>>();
assert::<
Lt6<'l0, 'l1, 'l2, 'l3, 'l4, 'l5>,
Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, Lt<'l4, Lt<'l5, ()>>>>>>,
>();
assert::<
Lt6<'l0, 'l1, 'l2, 'l3, 'l4, 'l5, L>,
Lt<'l0, Lt<'l1, Lt<'l2, Lt<'l3, Lt<'l4, Lt<'l5, L>>>>>>,
>();
}
};
// Head/Tail
const _: () = {
fn with_l<L: LtList>() {
fn assert<T: Is<U>, U>() {}
// Head gets the head of the list.
assert::<L::Head, HeadOf<L>>();
// Tail gets the tail of the list.
assert::<L::Tail, TailOf<L>>();
}
};
#[allow(unused)]
trait Is<U> {}
impl<T> Is<T> for T {}
*/