11error[E0277]: expected a `std::ops::Fn<()>` closure, found `fn() {foo}`
2- --> $DIR/fn-traits.rs:21 :10
2+ --> $DIR/fn-traits.rs:24 :10
33 |
44LL | fn call(f: impl Fn()) {
55 | ---- required by this bound in `call`
@@ -9,9 +9,10 @@ LL | call(foo);
99 |
1010 = help: the trait `std::ops::Fn<()>` is not implemented for `fn() {foo}`
1111 = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
12+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
1213
1314error[E0277]: expected a `std::ops::FnMut<()>` closure, found `fn() {foo}`
14- --> $DIR/fn-traits.rs:22 :14
15+ --> $DIR/fn-traits.rs:25 :14
1516 |
1617LL | fn call_mut(f: impl FnMut()) {
1718 | ------- required by this bound in `call_mut`
@@ -21,9 +22,10 @@ LL | call_mut(foo);
2122 |
2223 = help: the trait `std::ops::FnMut<()>` is not implemented for `fn() {foo}`
2324 = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
25+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
2426
2527error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `fn() {foo}`
26- --> $DIR/fn-traits.rs:23 :15
28+ --> $DIR/fn-traits.rs:26 :15
2729 |
2830LL | fn call_once(f: impl FnOnce()) {
2931 | -------- required by this bound in `call_once`
@@ -33,7 +35,44 @@ LL | call_once(foo);
3335 |
3436 = help: the trait `std::ops::FnOnce<()>` is not implemented for `fn() {foo}`
3537 = note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }
38+ = note: `fn() {foo}` has `#[target_feature]` and is unsafe to call
3639
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
3877
3978For more information about this error, try `rustc --explain E0277`.
0 commit comments