File: fn-trait.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 893,176 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (69 lines) | stat: -rw-r--r-- 2,986 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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: unsafe function cannot be called generically without an unsafe block
   = 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[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
  --> $DIR/fn-trait.rs:22:16
   |
LL |     require_fn(g);
   |     ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Fn()` is not implemented for fn item `extern "C" fn() -> i32 {g}`
   = note: wrap the `extern "C" fn() -> i32 {g}` 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[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[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
  --> $DIR/fn-trait.rs:26:16
   |
LL |     require_fn(h);
   |     ---------- ^ call the function in a closure: `|| unsafe { /* code */ }`
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Fn()` is not implemented for fn item `unsafe fn() -> i32 {h}`
   = note: unsafe function cannot be called generically without an unsafe block
   = note: wrap the `unsafe fn() -> i32 {h}` 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: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0277`.