1
1
error[E0277]: expected a `Fn()` closure, found `#[target_features] fn() {foo}`
2
- --> $DIR/fn-traits.rs:24 :10
2
+ --> $DIR/fn-traits.rs:31 :10
3
3
|
4
4
LL | call(foo);
5
5
| ---- ^^^ expected an `Fn()` closure, found `#[target_features] fn() {foo}`
@@ -9,14 +9,15 @@ LL | call(foo);
9
9
= help: the trait `Fn()` is not implemented for fn item `#[target_features] fn() {foo}`
10
10
= note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
11
11
= note: `#[target_feature]` functions do not implement the `Fn` traits
12
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
12
13
note: required by a bound in `call`
13
- --> $DIR/fn-traits.rs:11 :17
14
+ --> $DIR/fn-traits.rs:14 :17
14
15
|
15
16
LL | fn call(f: impl Fn()) {
16
17
| ^^^^ required by this bound in `call`
17
18
18
19
error[E0277]: expected a `FnMut()` closure, found `#[target_features] fn() {foo}`
19
- --> $DIR/fn-traits.rs:25 :14
20
+ --> $DIR/fn-traits.rs:32 :14
20
21
|
21
22
LL | call_mut(foo);
22
23
| -------- ^^^ expected an `FnMut()` closure, found `#[target_features] fn() {foo}`
@@ -26,14 +27,15 @@ LL | call_mut(foo);
26
27
= help: the trait `FnMut()` is not implemented for fn item `#[target_features] fn() {foo}`
27
28
= note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
28
29
= note: `#[target_feature]` functions do not implement the `Fn` traits
30
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
29
31
note: required by a bound in `call_mut`
30
- --> $DIR/fn-traits.rs:15 :25
32
+ --> $DIR/fn-traits.rs:18 :25
31
33
|
32
34
LL | fn call_mut(mut f: impl FnMut()) {
33
35
| ^^^^^^^ required by this bound in `call_mut`
34
36
35
37
error[E0277]: expected a `FnOnce()` closure, found `#[target_features] fn() {foo}`
36
- --> $DIR/fn-traits.rs:26 :15
38
+ --> $DIR/fn-traits.rs:33 :15
37
39
|
38
40
LL | call_once(foo);
39
41
| --------- ^^^ expected an `FnOnce()` closure, found `#[target_features] fn() {foo}`
@@ -43,14 +45,32 @@ LL | call_once(foo);
43
45
= help: the trait `FnOnce()` is not implemented for fn item `#[target_features] fn() {foo}`
44
46
= note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
45
47
= note: `#[target_feature]` functions do not implement the `Fn` traits
48
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
46
49
note: required by a bound in `call_once`
47
- --> $DIR/fn-traits.rs:19 :22
50
+ --> $DIR/fn-traits.rs:22 :22
48
51
|
49
52
LL | fn call_once(f: impl FnOnce()) {
50
53
| ^^^^^^^^ required by this bound in `call_once`
51
54
55
+ error[E0277]: expected a `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
56
+ --> $DIR/fn-traits.rs:34:19
57
+ |
58
+ LL | call_once_i32(bar);
59
+ | ------------- ^^^ expected an `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
60
+ | |
61
+ | required by a bound introduced by this call
62
+ |
63
+ = help: the trait `FnOnce(i32)` is not implemented for fn item `#[target_features] fn(i32) {bar}`
64
+ = note: `#[target_feature]` functions do not implement the `Fn` traits
65
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
66
+ note: required by a bound in `call_once_i32`
67
+ --> $DIR/fn-traits.rs:26:26
68
+ |
69
+ LL | fn call_once_i32(f: impl FnOnce(i32)) {
70
+ | ^^^^^^^^^^^ required by this bound in `call_once_i32`
71
+
52
72
error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
53
- --> $DIR/fn-traits.rs:28 :10
73
+ --> $DIR/fn-traits.rs:36 :10
54
74
|
55
75
LL | call(foo_unsafe);
56
76
| ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -61,14 +81,15 @@ LL | call(foo_unsafe);
61
81
= note: unsafe function cannot be called generically without an unsafe block
62
82
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
63
83
= note: `#[target_feature]` functions do not implement the `Fn` traits
84
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
64
85
note: required by a bound in `call`
65
- --> $DIR/fn-traits.rs:11 :17
86
+ --> $DIR/fn-traits.rs:14 :17
66
87
|
67
88
LL | fn call(f: impl Fn()) {
68
89
| ^^^^ required by this bound in `call`
69
90
70
91
error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
71
- --> $DIR/fn-traits.rs:30 :14
92
+ --> $DIR/fn-traits.rs:38 :14
72
93
|
73
94
LL | call_mut(foo_unsafe);
74
95
| -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -79,14 +100,15 @@ LL | call_mut(foo_unsafe);
79
100
= note: unsafe function cannot be called generically without an unsafe block
80
101
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
81
102
= note: `#[target_feature]` functions do not implement the `Fn` traits
103
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
82
104
note: required by a bound in `call_mut`
83
- --> $DIR/fn-traits.rs:15 :25
105
+ --> $DIR/fn-traits.rs:18 :25
84
106
|
85
107
LL | fn call_mut(mut f: impl FnMut()) {
86
108
| ^^^^^^^ required by this bound in `call_mut`
87
109
88
110
error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
89
- --> $DIR/fn-traits.rs:32 :15
111
+ --> $DIR/fn-traits.rs:40 :15
90
112
|
91
113
LL | call_once(foo_unsafe);
92
114
| --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -97,12 +119,13 @@ LL | call_once(foo_unsafe);
97
119
= note: unsafe function cannot be called generically without an unsafe block
98
120
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
99
121
= note: `#[target_feature]` functions do not implement the `Fn` traits
122
+ = note: try casting the function to a `fn` pointer or wrapping it in a closure
100
123
note: required by a bound in `call_once`
101
- --> $DIR/fn-traits.rs:19 :22
124
+ --> $DIR/fn-traits.rs:22 :22
102
125
|
103
126
LL | fn call_once(f: impl FnOnce()) {
104
127
| ^^^^^^^^ required by this bound in `call_once`
105
128
106
- error: aborting due to 6 previous errors
129
+ error: aborting due to 7 previous errors
107
130
108
131
For more information about this error, try `rustc --explain E0277`.
0 commit comments