]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-fn-error.rs
Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr
[rust.git] / src / test / ui / consts / const-fn-error.rs
1 const X : usize = 2;
2
3 const fn f(x: usize) -> usize {
4     let mut sum = 0;
5     for i in 0..x {
6         //~^ ERROR cannot convert
7         //~| ERROR `for` is not allowed in a `const fn`
8         //~| ERROR mutable references are not allowed in constant functions
9         //~| ERROR cannot call non-const fn
10         sum += i;
11     }
12     sum
13 }
14
15 #[allow(unused_variables)]
16 fn main() {
17     let a : [i32; f(X)];
18 }