|
1 | | -error[E0015]: cannot call non-const closure in constant functions |
| 1 | +error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied |
2 | 2 | --> $DIR/issue-56164.rs:1:18 |
3 | 3 | | |
4 | 4 | LL | const fn foo() { (||{})() } |
5 | | - | ^^^^^^^^ |
6 | | - | |
7 | | - = note: closures need an RFC before allowed to be called in constant functions |
8 | | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants |
9 | | - |
10 | | -error: function pointer calls are not allowed in constant functions |
11 | | - --> $DIR/issue-56164.rs:7:5 |
| 5 | + | ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]` |
12 | 6 | | |
13 | | -LL | input() |
14 | | - | ^^^^^^^ |
15 | | - |
16 | | -error: erroneous constant used |
| 7 | + = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]` |
| 8 | +note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const` |
17 | 9 | --> $DIR/issue-56164.rs:1:18 |
18 | 10 | | |
19 | 11 | LL | const fn foo() { (||{})() } |
20 | | - | ^^^^^^ referenced constant has errors |
21 | | - | |
22 | | - = note: `#[deny(const_err)]` on by default |
23 | | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
24 | | - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> |
25 | | - |
26 | | -error: aborting due to 3 previous errors |
| 12 | + | ^^^^^^^^ |
| 13 | + = note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }` |
27 | 14 |
|
28 | | -For more information about this error, try `rustc --explain E0015`. |
29 | | -Future incompatibility report: Future breakage diagnostic: |
30 | | -error: erroneous constant used |
31 | | - --> $DIR/issue-56164.rs:1:18 |
32 | | - | |
33 | | -LL | const fn foo() { (||{})() } |
34 | | - | ^^^^^^ referenced constant has errors |
35 | | - | |
36 | | - = note: `#[deny(const_err)]` on by default |
37 | | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
38 | | - = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> |
| 15 | +error: aborting due to previous error |
39 | 16 |
|
| 17 | +For more information about this error, try `rustc --explain E0277`. |
0 commit comments