11error[E0277]: expected a `Fn()` closure, found `#[target_features] fn() {foo}`
2- --> $DIR/fn-traits.rs:24 :10
2+ --> $DIR/fn-traits.rs:31 :10
33 |
44LL | call(foo);
55 | ---- ^^^ expected an `Fn()` closure, found `#[target_features] fn() {foo}`
@@ -9,14 +9,15 @@ LL | call(foo);
99 = help: the trait `Fn()` is not implemented for fn item `#[target_features] fn() {foo}`
1010 = note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
1111 = 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
1213note: required by a bound in `call`
13- --> $DIR/fn-traits.rs:11 :17
14+ --> $DIR/fn-traits.rs:14 :17
1415 |
1516LL | fn call(f: impl Fn()) {
1617 | ^^^^ required by this bound in `call`
1718
1819error[E0277]: expected a `FnMut()` closure, found `#[target_features] fn() {foo}`
19- --> $DIR/fn-traits.rs:25 :14
20+ --> $DIR/fn-traits.rs:32 :14
2021 |
2122LL | call_mut(foo);
2223 | -------- ^^^ expected an `FnMut()` closure, found `#[target_features] fn() {foo}`
@@ -26,14 +27,15 @@ LL | call_mut(foo);
2627 = help: the trait `FnMut()` is not implemented for fn item `#[target_features] fn() {foo}`
2728 = note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
2829 = 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
2931note: required by a bound in `call_mut`
30- --> $DIR/fn-traits.rs:15 :25
32+ --> $DIR/fn-traits.rs:18 :25
3133 |
3234LL | fn call_mut(mut f: impl FnMut()) {
3335 | ^^^^^^^ required by this bound in `call_mut`
3436
3537error[E0277]: expected a `FnOnce()` closure, found `#[target_features] fn() {foo}`
36- --> $DIR/fn-traits.rs:26 :15
38+ --> $DIR/fn-traits.rs:33 :15
3739 |
3840LL | call_once(foo);
3941 | --------- ^^^ expected an `FnOnce()` closure, found `#[target_features] fn() {foo}`
@@ -43,14 +45,32 @@ LL | call_once(foo);
4345 = help: the trait `FnOnce()` is not implemented for fn item `#[target_features] fn() {foo}`
4446 = note: wrap the `#[target_features] fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
4547 = 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
4649note: required by a bound in `call_once`
47- --> $DIR/fn-traits.rs:19 :22
50+ --> $DIR/fn-traits.rs:22 :22
4851 |
4952LL | fn call_once(f: impl FnOnce()) {
5053 | ^^^^^^^^ required by this bound in `call_once`
5154
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+
5272error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
53- --> $DIR/fn-traits.rs:28 :10
73+ --> $DIR/fn-traits.rs:36 :10
5474 |
5575LL | call(foo_unsafe);
5676 | ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -61,14 +81,15 @@ LL | call(foo_unsafe);
6181 = note: unsafe function cannot be called generically without an unsafe block
6282 = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
6383 = 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
6485note: required by a bound in `call`
65- --> $DIR/fn-traits.rs:11 :17
86+ --> $DIR/fn-traits.rs:14 :17
6687 |
6788LL | fn call(f: impl Fn()) {
6889 | ^^^^ required by this bound in `call`
6990
7091error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
71- --> $DIR/fn-traits.rs:30 :14
92+ --> $DIR/fn-traits.rs:38 :14
7293 |
7394LL | call_mut(foo_unsafe);
7495 | -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -79,14 +100,15 @@ LL | call_mut(foo_unsafe);
79100 = note: unsafe function cannot be called generically without an unsafe block
80101 = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
81102 = 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
82104note: required by a bound in `call_mut`
83- --> $DIR/fn-traits.rs:15 :25
105+ --> $DIR/fn-traits.rs:18 :25
84106 |
85107LL | fn call_mut(mut f: impl FnMut()) {
86108 | ^^^^^^^ required by this bound in `call_mut`
87109
88110error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
89- --> $DIR/fn-traits.rs:32 :15
111+ --> $DIR/fn-traits.rs:40 :15
90112 |
91113LL | call_once(foo_unsafe);
92114 | --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@@ -97,12 +119,13 @@ LL | call_once(foo_unsafe);
97119 = note: unsafe function cannot be called generically without an unsafe block
98120 = note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
99121 = 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
100123note: required by a bound in `call_once`
101- --> $DIR/fn-traits.rs:19 :22
124+ --> $DIR/fn-traits.rs:22 :22
102125 |
103126LL | fn call_once(f: impl FnOnce()) {
104127 | ^^^^^^^^ required by this bound in `call_once`
105128
106- error: aborting due to 6 previous errors
129+ error: aborting due to 7 previous errors
107130
108131For more information about this error, try `rustc --explain E0277`.
0 commit comments