summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/type-dependent/const-arg-in-const-arg.rs
blob: e844148346fb4950155f6c2b53c0e1bfa4f3cd97 (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
// run-pass
// revisions: full min
#![cfg_attr(full, feature(generic_const_exprs))]
#![allow(incomplete_features)]

struct Foo;

impl Foo {
    fn foo<const N: usize>(&self) -> usize {
        let f = self;
        f.bar::<{
            let f = Foo;
            f.bar::<7>()
        }>() + N
    }

    const fn bar<const M: usize>(&self) -> usize {
        M
    }
}

fn main() {
    let f = Foo;

    assert_eq!(f.foo::<13>(), 20)
}