1
1
error[E0277]: expected a `std::ops::Fn<()>` closure, found `fn() {foo}`
2
- --> $DIR/fn-traits.rs:21 :10
2
+ --> $DIR/fn-traits.rs:24 :10
3
3
|
4
4
LL | fn call(f: impl Fn()) {
5
5
| ---- required by this bound in `call`
@@ -9,9 +9,10 @@ LL | call(foo);
9
9
|
10
10
= help: the trait `std::ops::Fn<()>` is not implemented for `fn() {foo}`
11
11
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
12
+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
12
13
13
14
error[E0277]: expected a `std::ops::FnMut<()>` closure, found `fn() {foo}`
14
- --> $DIR/fn-traits.rs:22 :14
15
+ --> $DIR/fn-traits.rs:25 :14
15
16
|
16
17
LL | fn call_mut(f: impl FnMut()) {
17
18
| ------- required by this bound in `call_mut`
@@ -21,9 +22,10 @@ LL | call_mut(foo);
21
22
|
22
23
= help: the trait `std::ops::FnMut<()>` is not implemented for `fn() {foo}`
23
24
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
25
+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
24
26
25
27
error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `fn() {foo}`
26
- --> $DIR/fn-traits.rs:23 :15
28
+ --> $DIR/fn-traits.rs:26 :15
27
29
|
28
30
LL | fn call_once(f: impl FnOnce()) {
29
31
| -------- required by this bound in `call_once`
@@ -33,7 +35,44 @@ LL | call_once(foo);
33
35
|
34
36
= help: the trait `std::ops::FnOnce<()>` is not implemented for `fn() {foo}`
35
37
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
38
+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
36
39
37
- error: aborting due to 3 previous errors
40
+ error[E0277]: expected a `std::ops::Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
41
+ --> $DIR/fn-traits.rs:28:10
42
+ |
43
+ LL | fn call(f: impl Fn()) {
44
+ | ---- required by this bound in `call`
45
+ ...
46
+ LL | call(foo_unsafe);
47
+ | ^^^^^^^^^^ expected an `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
48
+ |
49
+ = help: the trait `std::ops::Fn<()>` is not implemented for `unsafe fn() {foo_unsafe}`
50
+ = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
51
+
52
+ error[E0277]: expected a `std::ops::FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
53
+ --> $DIR/fn-traits.rs:30:14
54
+ |
55
+ LL | fn call_mut(f: impl FnMut()) {
56
+ | ------- required by this bound in `call_mut`
57
+ ...
58
+ LL | call_mut(foo_unsafe);
59
+ | ^^^^^^^^^^ expected an `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
60
+ |
61
+ = help: the trait `std::ops::FnMut<()>` is not implemented for `unsafe fn() {foo_unsafe}`
62
+ = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
63
+
64
+ error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
65
+ --> $DIR/fn-traits.rs:32:15
66
+ |
67
+ LL | fn call_once(f: impl FnOnce()) {
68
+ | -------- required by this bound in `call_once`
69
+ ...
70
+ LL | call_once(foo_unsafe);
71
+ | ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
72
+ |
73
+ = help: the trait `std::ops::FnOnce<()>` is not implemented for `unsafe fn() {foo_unsafe}`
74
+ = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }
75
+
76
+ error: aborting due to 6 previous errors
38
77
39
78
For more information about this error, try `rustc --explain E0277`.
0 commit comments