about summary refs log tree commit diff
path: root/src/test/ui/const-generics/generic-function-call-in-array-length.rs
blob: a6d2bbd17eaabcf8c72aa617c83ac6a89e0f80ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// revisions: full min

#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]

const fn foo(n: usize) -> usize { n * 2 }

fn bar<const N: usize>() -> [u32; foo(N)] {
    //[min]~^ ERROR generic parameters may not be used in const operations
    //[full]~^^ ERROR constant expression depends on a generic parameter
    [0; foo(N)]
    //[min]~^ ERROR generic parameters may not be used in const operations
}

fn main() {}