summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-inherent-types/generic-const-exprs.rs
blob: a4ac0ecfa4cf936e4e806122043b85de3fe3bc31 (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
// check-pass

#![feature(inherent_associated_types, generic_const_exprs)]
#![allow(incomplete_features)]

struct Parent<const O: usize>;

impl<const O: usize> Parent<O> {
    type Mapping<const I: usize> = Store<{ O + I }>
    where
        [(); O + I]:
    ;
}

struct Store<const N: usize>;

impl<const N: usize> Store<N> {
    const REIFIED: usize = N;

    fn reify() -> usize {
        N
    }
}

fn main() {
    let _ = Parent::<2>::Mapping::<{ 12 * 2 }>::REIFIED;
    let _ = Parent::<1>::Mapping::<{ 2 * 5 }>::reify();
}