blob: 4e6707bba51cecc75b92d640d1b16f07f5b56007 [file] [log] [blame]
Michael Gouletcde29b92024-10-20 19:49:111error: `~const` can only be applied to `#[const_trait]` traits
2 --> $DIR/const-closure-trait-method-fail.rs:14:39
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 {
5 | ^^^^^^^^^^^^^^^^^
Deadbeef373e9062024-06-25 09:50:016
León Orell Valerian Liehr3eb48a32023-12-18 16:55:557error: `~const` can only be applied to `#[const_trait]` traits
Deadbeef04eec372023-08-13 09:02:318 --> $DIR/const-closure-trait-method-fail.rs:14:39
Deadbeef2d594512023-07-27 15:51:029 |
Deadbeef04eec372023-08-13 09:02:3110LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
11 | ^^^^^^^^^^^^^^^^^
Michael Gouletcde29b92024-10-20 19:49:1112 |
13 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
Deadbeef983606d2022-12-28 08:55:0114
Oli Scherereab2adb2024-02-01 22:45:0015error[E0015]: cannot call non-const closure in constant functions
16 --> $DIR/const-closure-trait-method-fail.rs:15:5
17 |
18LL | x(())
19 | ^^^^^
20 |
21 = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
Oli Scherereab2adb2024-02-01 22:45:0022help: consider further restricting this bound
23 |
Esteban Kübere6bd6c22024-05-29 21:42:4024LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 {
25 | +++++++++++++++++++
Esteban Küber6c31f6c2024-03-07 22:09:0026help: add `#![feature(effects)]` to the crate attributes to enable
27 |
28LL + #![feature(effects)]
29 |
Deadbeef983606d2022-12-28 08:55:0130
Deadbeef373e9062024-06-25 09:50:0131error: aborting due to 3 previous errors
Oli Scherereab2adb2024-02-01 22:45:0032
Michael Gouletcde29b92024-10-20 19:49:1133For more information about this error, try `rustc --explain E0015`.