Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame] | 1 | error: `~const` can only be applied to `#[const_trait]` traits |
Michael Goulet | bd95695 | 2024-10-26 20:54:38 | [diff] [blame] | 2 | --> $DIR/const-closure-trait-method-fail.rs:14:32 |
Deadbeef | 373e906 | 2024-06-25 09:50:01 | [diff] [blame] | 3 | | |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame] | 4 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { |
Esteban Küber | 4007fc9 | 2024-12-09 19:34:43 | [diff] [blame] | 5 | | ^^^^^^ can't be applied to `FnOnce` |
| 6 | | |
| 7 | note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` |
| 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
Deadbeef | 373e906 | 2024-06-25 09:50:01 | [diff] [blame] | 9 | |
León Orell Valerian Liehr | 3eb48a3 | 2023-12-18 16:55:55 | [diff] [blame] | 10 | error: `~const` can only be applied to `#[const_trait]` traits |
Michael Goulet | bd95695 | 2024-10-26 20:54:38 | [diff] [blame] | 11 | --> $DIR/const-closure-trait-method-fail.rs:14:32 |
Deadbeef | 2d59451 | 2023-07-27 15:51:02 | [diff] [blame] | 12 | | |
Deadbeef | 04eec37 | 2023-08-13 09:02:31 | [diff] [blame] | 13 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { |
Esteban Küber | 4007fc9 | 2024-12-09 19:34:43 | [diff] [blame] | 14 | | ^^^^^^ can't be applied to `FnOnce` |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame] | 15 | | |
Esteban Küber | 4007fc9 | 2024-12-09 19:34:43 | [diff] [blame] | 16 | note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]` |
| 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame] | 18 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
Deadbeef | 983606d | 2022-12-28 08:55:01 | [diff] [blame] | 19 | |
Oli Scherer | eab2adb | 2024-02-01 22:45:00 | [diff] [blame] | 20 | error[E0015]: cannot call non-const closure in constant functions |
| 21 | --> $DIR/const-closure-trait-method-fail.rs:15:5 |
| 22 | | |
| 23 | LL | x(()) |
| 24 | | ^^^^^ |
| 25 | | |
| 26 | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants |
Deadbeef | 983606d | 2022-12-28 08:55:01 | [diff] [blame] | 27 | |
Deadbeef | 373e906 | 2024-06-25 09:50:01 | [diff] [blame] | 28 | error: aborting due to 3 previous errors |
Oli Scherer | eab2adb | 2024-02-01 22:45:00 | [diff] [blame] | 29 | |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame] | 30 | For more information about this error, try `rustc --explain E0015`. |