]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-fn-error.stderr
Rollup merge of #105674 - estebank:iterator-chains, r=oli-obk
[rust.git] / src / test / ui / consts / const-fn-error.stderr
1 error[E0658]: `for` is not allowed in a `const fn`
2   --> $DIR/const-fn-error.rs:5:5
3    |
4 LL | /     for i in 0..x {
5 LL | |
6 LL | |
7 LL | |
8 LL | |
9 LL | |         sum += i;
10 LL | |     }
11    | |_____^
12    |
13    = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
14    = help: add `#![feature(const_for)]` to the crate attributes to enable
15
16 error[E0015]: cannot convert `std::ops::Range<usize>` into an iterator in constant functions
17   --> $DIR/const-fn-error.rs:5:14
18    |
19 LL |     for i in 0..x {
20    |              ^^^^
21    |
22 note: impl defined here, but it is not `const`
23   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
24    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
25
26 error[E0658]: mutable references are not allowed in constant functions
27   --> $DIR/const-fn-error.rs:5:14
28    |
29 LL |     for i in 0..x {
30    |              ^^^^
31    |
32    = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
33    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
34
35 error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
36   --> $DIR/const-fn-error.rs:5:14
37    |
38 LL |     for i in 0..x {
39    |              ^^^^
40    |
41    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
42
43 error: aborting due to 4 previous errors
44
45 Some errors have detailed explanations: E0015, E0658.
46 For more information about an error, try `rustc --explain E0015`.