about summary refs log tree commit diff
path: root/tests/crashes/117392.rs
blob: 95fdf63f893ec521674388b2cd3a0d2e7d9eaf04 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//@ known-bug: #117392
pub trait BorrowComposite {
    type Ref<'a>
    where
        Self: 'a;
}

impl BorrowComposite for () {
    type Ref<'a> = ();
}

pub trait Component<Args: BorrowComposite> {
    type Output;
}

impl<Args: BorrowComposite> Component<Args> for () {
    type Output = ();
}

struct Delay<Make> {
    _make: Make,
}

impl<
        Args: BorrowComposite,
        Make: for<'a> FnMut(Args::Ref<'a>) -> C,
        C: Component<Args>,
    > Component<Args> for Delay<Make>
{
    type Output = C::Output;
}

pub fn delay<
    Args: BorrowComposite,
    Make: for<'a> FnMut(Args::Ref<'a>) -> C,
    C: Component<Args>,
>(
    make: Make,
) -> impl Component<Args, Output = C::Output> {
    Delay { _make: make }
}

pub fn crash() -> impl Component<(), Output = ()> {
    delay(|()| delay(|()| ()))
}

pub fn main() {}