e6bd6c2044
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Fix #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
45 lines
1.8 KiB
Plaintext
45 lines
1.8 KiB
Plaintext
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/unstable-const-fn-in-libcore.rs:19:39
|
|
|
|
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error[E0015]: cannot call non-const closure in constant functions
|
|
--> $DIR/unstable-const-fn-in-libcore.rs:24:26
|
|
|
|
|
LL | Opt::None => f(),
|
|
| ^^^
|
|
|
|
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
|
help: consider further restricting this bound
|
|
|
|
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T {
|
|
| +++++++++++++++++
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0493]: destructor of `F` cannot be evaluated at compile-time
|
|
--> $DIR/unstable-const-fn-in-libcore.rs:19:60
|
|
|
|
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
|
|
| ^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error[E0493]: destructor of `Opt<T>` cannot be evaluated at compile-time
|
|
--> $DIR/unstable-const-fn-in-libcore.rs:19:54
|
|
|
|
|
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
|
|
| ^^^^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
Some errors have detailed explanations: E0015, E0493.
|
|
For more information about an error, try `rustc --explain E0015`.
|