]>
Commit | Line | Data |
---|---|---|
9cc50fc6 | 1 | const X : usize = 2; |
85aaf69f | 2 | |
9cc50fc6 | 3 | const fn f(x: usize) -> usize { |
0531ce1d | 4 | let mut sum = 0; |
0531ce1d | 5 | for i in 0..x { |
2b03887a | 6 | //~^ ERROR cannot convert |
94222f64 | 7 | //~| ERROR `for` is not allowed in a `const fn` |
2b03887a FG |
8 | //~| ERROR mutable references are not allowed in constant functions |
9 | //~| ERROR cannot call non-const fn | |
353b0b11 | 10 | //~| ERROR the trait bound |
9cc50fc6 SL |
11 | sum += i; |
12 | } | |
0531ce1d | 13 | sum |
85aaf69f | 14 | } |
223e47cc | 15 | |
9cc50fc6 | 16 | #[allow(unused_variables)] |
223e47cc | 17 | fn main() { |
a1dfa0c6 | 18 | let a : [i32; f(X)]; |
223e47cc | 19 | } |