|
| 1 | +error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32` |
| 2 | + --> $DIR/fn-trait.rs:20:16 |
| 3 | + | |
| 4 | +LL | require_fn(f as unsafe fn() -> i32); |
| 5 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` |
| 6 | + | | |
| 7 | + | required by a bound introduced by this call |
| 8 | + | |
| 9 | + = help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32` |
| 10 | + = note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }` |
| 11 | +note: required by a bound in `require_fn` |
| 12 | + --> $DIR/fn-trait.rs:3:23 |
| 13 | + | |
| 14 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 15 | + | ^^^^^^^^^^^ required by this bound in `require_fn` |
| 16 | + |
| 17 | +error[E0271]: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32` |
| 18 | + --> $DIR/fn-trait.rs:20:16 |
| 19 | + | |
| 20 | +LL | require_fn(f as unsafe fn() -> i32); |
| 21 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ |
| 22 | + | | |
| 23 | + | required by a bound introduced by this call |
| 24 | + | |
| 25 | +note: required by a bound in `require_fn` |
| 26 | + --> $DIR/fn-trait.rs:3:31 |
| 27 | + | |
| 28 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 29 | + | ^^^ required by this bound in `require_fn` |
| 30 | + |
| 31 | +error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32` |
| 32 | + --> $DIR/fn-trait.rs:24:16 |
| 33 | + | |
| 34 | +LL | require_fn(g as extern "C" fn() -> i32); |
| 35 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32` |
| 36 | + | | |
| 37 | + | required by a bound introduced by this call |
| 38 | + | |
| 39 | + = help: the trait `Fn<()>` is not implemented for `extern "C" fn() -> i32` |
| 40 | + = note: wrap the `extern "C" fn() -> i32` in a closure with no arguments: `|| { /* code */ }` |
| 41 | +note: required by a bound in `require_fn` |
| 42 | + --> $DIR/fn-trait.rs:3:23 |
| 43 | + | |
| 44 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 45 | + | ^^^^^^^^^^^ required by this bound in `require_fn` |
| 46 | + |
| 47 | +error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32` |
| 48 | + --> $DIR/fn-trait.rs:24:16 |
| 49 | + | |
| 50 | +LL | require_fn(g as extern "C" fn() -> i32); |
| 51 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ |
| 52 | + | | |
| 53 | + | required by a bound introduced by this call |
| 54 | + | |
| 55 | +note: required by a bound in `require_fn` |
| 56 | + --> $DIR/fn-trait.rs:3:31 |
| 57 | + | |
| 58 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 59 | + | ^^^ required by this bound in `require_fn` |
| 60 | + |
| 61 | +error: aborting due to 4 previous errors |
| 62 | + |
| 63 | +Some errors have detailed explanations: E0271, E0277. |
| 64 | +For more information about an error, try `rustc --explain E0271`. |
0 commit comments