mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
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) { | ++++++ ```
67 lines
2.3 KiB
Plaintext
67 lines
2.3 KiB
Plaintext
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
|
|
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
|
|
|
|
|
LL | / async fn wrapper<F>(f: F)
|
|
LL | |
|
|
LL | |
|
|
LL | |
|
|
... |
|
|
LL | | F:,
|
|
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
|
|
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
|
|
|
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
|
|
|
|
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
|
|
--> $DIR/issue-76168-hr-outlives-3.rs:6:10
|
|
|
|
|
LL | async fn wrapper<F>(f: F)
|
|
| ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
|
|
|
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
|
|
|
|
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
|
|
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
|
|
|
|
|
LL | / async fn wrapper<F>(f: F)
|
|
LL | |
|
|
LL | |
|
|
LL | |
|
|
... |
|
|
LL | | F:,
|
|
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
|
|
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
|
|
|
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
|
|
|
|
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
|
|
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
|
|
|
|
|
LL | / async fn wrapper<F>(f: F)
|
|
LL | |
|
|
LL | |
|
|
LL | |
|
|
... |
|
|
LL | | F:,
|
|
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
|
|
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
|
|
|
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
|
|
--> $DIR/issue-76168-hr-outlives-3.rs:14:1
|
|
|
|
|
LL | / {
|
|
LL | |
|
|
LL | | let mut i = 41;
|
|
LL | | &mut i;
|
|
LL | | }
|
|
| |_^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
|
|
|
|
|
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
|
|
|
|
error: aborting due to 5 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|