65 lines
2.5 KiB
Plaintext
65 lines
2.5 KiB
Plaintext
error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
|
|
--> $DIR/fn-trait.rs:20:16
|
|
|
|
|
LL | require_fn(f as unsafe fn() -> i32);
|
|
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32`
|
|
= note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }`
|
|
note: required by a bound in `require_fn`
|
|
--> $DIR/fn-trait.rs:3:23
|
|
|
|
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
|
|
|
error[E0271]: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
--> $DIR/fn-trait.rs:20:16
|
|
|
|
|
LL | require_fn(f as unsafe fn() -> i32);
|
|
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
note: required by a bound in `require_fn`
|
|
--> $DIR/fn-trait.rs:3:31
|
|
|
|
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
| ^^^ required by this bound in `require_fn`
|
|
|
|
error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
|
|
--> $DIR/fn-trait.rs:24:16
|
|
|
|
|
LL | require_fn(g as extern "C" fn() -> i32);
|
|
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32`
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: the trait `Fn<()>` is not implemented for `extern "C" fn() -> i32`
|
|
= note: wrap the `extern "C" fn() -> i32` in a closure with no arguments: `|| { /* code */ }`
|
|
note: required by a bound in `require_fn`
|
|
--> $DIR/fn-trait.rs:3:23
|
|
|
|
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
|
|
|
error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
|
|
--> $DIR/fn-trait.rs:24:16
|
|
|
|
|
LL | require_fn(g as extern "C" fn() -> i32);
|
|
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
note: required by a bound in `require_fn`
|
|
--> $DIR/fn-trait.rs:3:31
|
|
|
|
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
| ^^^ required by this bound in `require_fn`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
Some errors have detailed explanations: E0271, E0277.
|
|
For more information about an error, try `rustc --explain E0271`.
|