|
| 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 {g}` |
| 32 | + --> $DIR/fn-trait.rs:23:16 |
| 33 | + | |
| 34 | +LL | require_fn(g); |
| 35 | + | ---------- ^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32 {g}` |
| 36 | + | | |
| 37 | + | required by a bound introduced by this call |
| 38 | + | |
| 39 | + = help: the trait `Fn<()>` is not implemented for fn item `extern "C" fn() -> i32 {g}` |
| 40 | + = note: wrap the `extern "C" fn() -> i32 {g}` 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 {g} as FnOnce<()>>::Output == i32` |
| 48 | + --> $DIR/fn-trait.rs:23:16 |
| 49 | + | |
| 50 | +LL | require_fn(g); |
| 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[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32` |
| 62 | + --> $DIR/fn-trait.rs:26:16 |
| 63 | + | |
| 64 | +LL | require_fn(g as extern "C" fn() -> i32); |
| 65 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32` |
| 66 | + | | |
| 67 | + | required by a bound introduced by this call |
| 68 | + | |
| 69 | + = help: the trait `Fn<()>` is not implemented for `extern "C" fn() -> i32` |
| 70 | + = note: wrap the `extern "C" fn() -> i32` in a closure with no arguments: `|| { /* code */ }` |
| 71 | +note: required by a bound in `require_fn` |
| 72 | + --> $DIR/fn-trait.rs:3:23 |
| 73 | + | |
| 74 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 75 | + | ^^^^^^^^^^^ required by this bound in `require_fn` |
| 76 | + |
| 77 | +error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32` |
| 78 | + --> $DIR/fn-trait.rs:26:16 |
| 79 | + | |
| 80 | +LL | require_fn(g as extern "C" fn() -> i32); |
| 81 | + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ |
| 82 | + | | |
| 83 | + | required by a bound introduced by this call |
| 84 | + | |
| 85 | +note: required by a bound in `require_fn` |
| 86 | + --> $DIR/fn-trait.rs:3:31 |
| 87 | + | |
| 88 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 89 | + | ^^^ required by this bound in `require_fn` |
| 90 | + |
| 91 | +error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}` |
| 92 | + --> $DIR/fn-trait.rs:29:16 |
| 93 | + | |
| 94 | +LL | require_fn(h); |
| 95 | + | ---------- ^ call the function in a closure: `|| unsafe { /* code */ }` |
| 96 | + | | |
| 97 | + | required by a bound introduced by this call |
| 98 | + | |
| 99 | + = help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() -> i32 {h}` |
| 100 | + = note: wrap the `unsafe fn() -> i32 {h}` in a closure with no arguments: `|| { /* code */ }` |
| 101 | +note: required by a bound in `require_fn` |
| 102 | + --> $DIR/fn-trait.rs:3:23 |
| 103 | + | |
| 104 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 105 | + | ^^^^^^^^^^^ required by this bound in `require_fn` |
| 106 | + |
| 107 | +error[E0271]: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32` |
| 108 | + --> $DIR/fn-trait.rs:29:16 |
| 109 | + | |
| 110 | +LL | require_fn(h); |
| 111 | + | ---------- ^ types differ |
| 112 | + | | |
| 113 | + | required by a bound introduced by this call |
| 114 | + | |
| 115 | +note: required by a bound in `require_fn` |
| 116 | + --> $DIR/fn-trait.rs:3:31 |
| 117 | + | |
| 118 | +LL | fn require_fn(_: impl Fn() -> i32) {} |
| 119 | + | ^^^ required by this bound in `require_fn` |
| 120 | + |
| 121 | +error: aborting due to 8 previous errors |
| 122 | + |
| 123 | +Some errors have detailed explanations: E0271, E0277. |
| 124 | +For more information about an error, try `rustc --explain E0271`. |
0 commit comments