Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame^] | 1 | error: `~const` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-closure-trait-method-fail.rs:14:39 |
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 { |
| 5 | | ^^^^^^^^^^^^^^^^^ |
Deadbeef | 373e906 | 2024-06-25 09:50:01 | [diff] [blame] | 6 | |
León Orell Valerian Liehr | 3eb48a3 | 2023-12-18 16:55:55 | [diff] [blame] | 7 | error: `~const` can only be applied to `#[const_trait]` traits |
Deadbeef | 04eec37 | 2023-08-13 09:02:31 | [diff] [blame] | 8 | --> $DIR/const-closure-trait-method-fail.rs:14:39 |
Deadbeef | 2d59451 | 2023-07-27 15:51:02 | [diff] [blame] | 9 | | |
Deadbeef | 04eec37 | 2023-08-13 09:02:31 | [diff] [blame] | 10 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { |
| 11 | | ^^^^^^^^^^^^^^^^^ |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame^] | 12 | | |
| 13 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
Deadbeef | 983606d | 2022-12-28 08:55:01 | [diff] [blame] | 14 | |
Oli Scherer | eab2adb | 2024-02-01 22:45:00 | [diff] [blame] | 15 | error[E0015]: cannot call non-const closure in constant functions |
| 16 | --> $DIR/const-closure-trait-method-fail.rs:15:5 |
| 17 | | |
| 18 | LL | x(()) |
| 19 | | ^^^^^ |
| 20 | | |
| 21 | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants |
Oli Scherer | eab2adb | 2024-02-01 22:45:00 | [diff] [blame] | 22 | help: consider further restricting this bound |
| 23 | | |
Esteban Küber | e6bd6c2 | 2024-05-29 21:42:40 | [diff] [blame] | 24 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 { |
| 25 | | +++++++++++++++++++ |
Esteban Küber | 6c31f6c | 2024-03-07 22:09:00 | [diff] [blame] | 26 | help: add `#![feature(effects)]` to the crate attributes to enable |
| 27 | | |
| 28 | LL + #![feature(effects)] |
| 29 | | |
Deadbeef | 983606d | 2022-12-28 08:55:01 | [diff] [blame] | 30 | |
Deadbeef | 373e906 | 2024-06-25 09:50:01 | [diff] [blame] | 31 | error: aborting due to 3 previous errors |
Oli Scherer | eab2adb | 2024-02-01 22:45:00 | [diff] [blame] | 32 | |
Michael Goulet | cde29b9 | 2024-10-20 19:49:11 | [diff] [blame^] | 33 | For more information about this error, try `rustc --explain E0015`. |