summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-44255.rs
blob: 2245032043257ec35ea7e39ddae6e6024673bac4 (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
// run-pass

use std::marker::PhantomData;

fn main() {
    let _arr = [1; <Multiply<Five, Five>>::VAL];
}

trait TypeVal<T> {
    const VAL: T;
}

struct Five;

impl TypeVal<usize> for Five {
    const VAL: usize = 5;
}

struct Multiply<N, M> {
    _n: PhantomData<N>,
    _m: PhantomData<M>,
}

impl<N, M> TypeVal<usize> for Multiply<N, M>
    where N: TypeVal<usize>,
          M: TypeVal<usize>,
{
    const VAL: usize = N::VAL * M::VAL;
}