File: 107362.rs

package info (click to toggle)
rustc-web 1.85.0%2Bdfsg3-1~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-proposed-updates
  • size: 1,759,988 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,056; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (43 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (7)
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
//@ known-bug: #107362
//@ compile-flags: -Cdebuginfo=2

pub trait Functor
{
    type With<T>: Functor;
}

pub struct IdFunctor<T>(T);
impl<T> Functor for IdFunctor<T> {
    type With<T2> = IdFunctor<T2>;
}

impl<T> Functor for Vec<T> {
    type With<T2> = Vec<T2> ;
}


pub struct Compose<F1, F2, T>(F1::With<F2::With<T>>)
where
    F1: Functor + ?Sized,
    F2: Functor + ?Sized;

impl<F1, F2, T> Functor for Compose<F1, F2, T>
where
    F1: Functor + ?Sized,
    F2: Functor + ?Sized
{
    type With<T2> = F1::With<F2::With<T2>> ;
}

pub enum Value<F>
where
    F: Functor + ?Sized,
{
    SignedInt(*mut F::With<i64>),
    Array(*mut Value<Compose<F, Vec<()>, ()>>),

}

fn main() {
    let x: Value<IdFunctor<()>> = Value::SignedInt(&mut IdFunctor(1));
}