about summary refs log tree commit diff
path: root/src/test/compile-fail/consts/const-fn-error.rs
blob: 1de23f2a5e94f29067fdec0b74243f195f27b6a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![feature(const_fn)]

const X : usize = 2;

const fn f(x: usize) -> usize {
    let mut sum = 0;
    for i in 0..x {
        //~^ ERROR E0015
        //~| ERROR E0017
        //~| ERROR E0019
        //~| ERROR E0019
        //~| ERROR E0080
        sum += i;
    }
    sum
}

#[allow(unused_variables)]
fn main() {
    let a : [i32; f(X)];
}