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