summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/next-solver/fn-trait.stderr
blob: e33487235e6631f8310de3ae8da97f174eb1367e (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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[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 {g}`
  --> $DIR/fn-trait.rs:23: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[E0271]: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
  --> $DIR/fn-trait.rs:23:16
   |
LL |     require_fn(g);
   |     ---------- ^ 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:26: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:26: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[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
  --> $DIR/fn-trait.rs:29: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[E0271]: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
  --> $DIR/fn-trait.rs:29:16
   |
LL |     require_fn(h);
   |     ---------- ^ 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 8 previous errors

Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.