blob: 2a97846ccb44873f9d05c25e081ba42ae6f0e3bb [file] [log] [blame]
Michael Gouletcde29b92024-10-20 19:49:111error: `~const` can only be applied to `#[const_trait]` traits
Michael Gouletbd956952024-10-26 20:54:382 --> $DIR/const-closure-trait-method-fail.rs:14:32
Deadbeef373e9062024-06-25 09:50:013 |
Michael Gouletcde29b92024-10-20 19:49:114LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
Esteban Küber4007fc92024-12-09 19:34:435 | ^^^^^^ can't be applied to `FnOnce`
6 |
7note: `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
Deadbeef373e9062024-06-25 09:50:019
León Orell Valerian Liehr3eb48a32023-12-18 16:55:5510error: `~const` can only be applied to `#[const_trait]` traits
Michael Gouletbd956952024-10-26 20:54:3811 --> $DIR/const-closure-trait-method-fail.rs:14:32
Deadbeef2d594512023-07-27 15:51:0212 |
Deadbeef04eec372023-08-13 09:02:3113LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
Esteban Küber4007fc92024-12-09 19:34:4314 | ^^^^^^ can't be applied to `FnOnce`
Michael Gouletcde29b92024-10-20 19:49:1115 |
Esteban Küber4007fc92024-12-09 19:34:4316note: `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 Gouletcde29b92024-10-20 19:49:1118 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
Deadbeef983606d2022-12-28 08:55:0119
Oli Scherereab2adb2024-02-01 22:45:0020error[E0015]: cannot call non-const closure in constant functions
21 --> $DIR/const-closure-trait-method-fail.rs:15:5
22 |
23LL | x(())
24 | ^^^^^
25 |
26 = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
Deadbeef983606d2022-12-28 08:55:0127
Deadbeef373e9062024-06-25 09:50:0128error: aborting due to 3 previous errors
Oli Scherereab2adb2024-02-01 22:45:0029
Michael Gouletcde29b92024-10-20 19:49:1130For more information about this error, try `rustc --explain E0015`.