fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32` 2 --> $DIR/fn-trait.rs:20:16 3 | 4LL | 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 */ }` 11note: required by a bound in `require_fn` 12 --> $DIR/fn-trait.rs:3:23 13 | 14LL | fn require_fn(_: impl Fn() -> i32) {} 15 | ^^^^^^^^^^^ required by this bound in `require_fn` 16 17error[E0271]: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32` 18 --> $DIR/fn-trait.rs:20:16 19 | 20LL | require_fn(f as unsafe fn() -> i32); 21 | ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ 22 | | 23 | required by a bound introduced by this call 24 | 25note: required by a bound in `require_fn` 26 --> $DIR/fn-trait.rs:3:31 27 | 28LL | fn require_fn(_: impl Fn() -> i32) {} 29 | ^^^ required by this bound in `require_fn` 30 31error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}` 32 --> $DIR/fn-trait.rs:23:16 33 | 34LL | 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 */ }` 41note: required by a bound in `require_fn` 42 --> $DIR/fn-trait.rs:3:23 43 | 44LL | fn require_fn(_: impl Fn() -> i32) {} 45 | ^^^^^^^^^^^ required by this bound in `require_fn` 46 47error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32` 48 --> $DIR/fn-trait.rs:23:16 49 | 50LL | require_fn(g); 51 | ---------- ^ types differ 52 | | 53 | required by a bound introduced by this call 54 | 55note: required by a bound in `require_fn` 56 --> $DIR/fn-trait.rs:3:31 57 | 58LL | fn require_fn(_: impl Fn() -> i32) {} 59 | ^^^ required by this bound in `require_fn` 60 61error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32` 62 --> $DIR/fn-trait.rs:26:16 63 | 64LL | 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 */ }` 71note: required by a bound in `require_fn` 72 --> $DIR/fn-trait.rs:3:23 73 | 74LL | fn require_fn(_: impl Fn() -> i32) {} 75 | ^^^^^^^^^^^ required by this bound in `require_fn` 76 77error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32` 78 --> $DIR/fn-trait.rs:26:16 79 | 80LL | require_fn(g as extern "C" fn() -> i32); 81 | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ 82 | | 83 | required by a bound introduced by this call 84 | 85note: required by a bound in `require_fn` 86 --> $DIR/fn-trait.rs:3:31 87 | 88LL | fn require_fn(_: impl Fn() -> i32) {} 89 | ^^^ required by this bound in `require_fn` 90 91error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}` 92 --> $DIR/fn-trait.rs:29:16 93 | 94LL | 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 */ }` 101note: required by a bound in `require_fn` 102 --> $DIR/fn-trait.rs:3:23 103 | 104LL | fn require_fn(_: impl Fn() -> i32) {} 105 | ^^^^^^^^^^^ required by this bound in `require_fn` 106 107error[E0271]: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32` 108 --> $DIR/fn-trait.rs:29:16 109 | 110LL | require_fn(h); 111 | ---------- ^ types differ 112 | | 113 | required by a bound introduced by this call 114 | 115note: required by a bound in `require_fn` 116 --> $DIR/fn-trait.rs:3:31 117 | 118LL | fn require_fn(_: impl Fn() -> i32) {} 119 | ^^^ required by this bound in `require_fn` 120 121error: aborting due to 8 previous errors 122 123Some errors have detailed explanations: E0271, E0277. 124For more information about an error, try `rustc --explain E0271`.