File tree 2 files changed +19
-3
lines changed
src/test/ui/rfc-2632-const-trait-impl
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ struct Bug {
4
4
inner : [ ( ) ; match || 1 {
5
5
n => n ( ) ,
6
6
//~^ ERROR the trait bound
7
- //~| ERROR cannot call non-const fn `Bug::inner::{constant#0}::{closure#0}` in constants
7
+ //~| ERROR the trait bound
8
+ //~| ERROR cannot call non-const closure in constants
8
9
} ] ,
9
10
}
10
11
Original file line number Diff line number Diff line change @@ -12,15 +12,30 @@ LL | n => n(),
12
12
| ^^^
13
13
= note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
14
14
15
- error[E0015]: cannot call non-const fn `Bug::inner::{constant#0}::{closure#0}` in constants
15
+ error[E0277]: the trait bound `[closure@$DIR/issue-102985.rs:4:23: 4:25]: ~const Fn<()>` is not satisfied
16
+ --> $DIR/issue-102985.rs:5:14
17
+ |
18
+ LL | n => n(),
19
+ | ^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
20
+ |
21
+ = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-102985.rs:4:23: 4:25]`
22
+ note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-102985.rs:4:23: 4:25]`, but that implementation is not `const`
23
+ --> $DIR/issue-102985.rs:5:14
24
+ |
25
+ LL | n => n(),
26
+ | ^^^
27
+ = note: wrap the `[closure@$DIR/issue-102985.rs:4:23: 4:25]` in a closure with no arguments: `|| { /* code */ }`
28
+
29
+ error[E0015]: cannot call non-const closure in constants
16
30
--> $DIR/issue-102985.rs:5:14
17
31
|
18
32
LL | n => n(),
19
33
| ^^^
20
34
|
35
+ = note: closures need an RFC before allowed to be called in constants
21
36
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
22
37
23
- error: aborting due to 2 previous errors
38
+ error: aborting due to 3 previous errors
24
39
25
40
Some errors have detailed explanations: E0015, E0277.
26
41
For more information about an error, try `rustc --explain E0015`.
You can’t perform that action at this time.
0 commit comments