|
1 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 1 | +warning: taking a reference to a function item does not give a function pointer |
2 | 2 | --> $DIR/function-item-references.rs:40:18
|
3 | 3 | |
|
4 | 4 | LL | Pointer::fmt(&zst_ref, f)
|
5 |
| - | ^^^^^^^^ |
| 5 | + | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
6 | 6 | |
|
7 | 7 | note: the lint level is defined here
|
8 | 8 | --> $DIR/function-item-references.rs:3:9
|
9 | 9 | |
|
10 | 10 | LL | #![warn(function_item_references)]
|
11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^
|
12 | 12 |
|
13 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 13 | +warning: taking a reference to a function item does not give a function pointer |
14 | 14 | --> $DIR/function-item-references.rs:77:22
|
15 | 15 | |
|
16 | 16 | LL | println!("{:p}", &foo);
|
17 |
| - | ^^^^ |
| 17 | + | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
18 | 18 |
|
19 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 19 | +warning: taking a reference to a function item does not give a function pointer |
20 | 20 | --> $DIR/function-item-references.rs:79:20
|
21 | 21 | |
|
22 | 22 | LL | print!("{:p}", &foo);
|
23 |
| - | ^^^^ |
| 23 | + | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
24 | 24 |
|
25 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 25 | +warning: taking a reference to a function item does not give a function pointer |
26 | 26 | --> $DIR/function-item-references.rs:81:21
|
27 | 27 | |
|
28 | 28 | LL | format!("{:p}", &foo);
|
29 |
| - | ^^^^ |
| 29 | + | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
30 | 30 |
|
31 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 31 | +warning: taking a reference to a function item does not give a function pointer |
32 | 32 | --> $DIR/function-item-references.rs:84:22
|
33 | 33 | |
|
34 | 34 | LL | println!("{:p}", &foo as *const _);
|
35 |
| - | ^^^^^^^^^^^^^^^^ |
| 35 | + | ^^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
36 | 36 |
|
37 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 37 | +warning: taking a reference to a function item does not give a function pointer |
38 | 38 | --> $DIR/function-item-references.rs:86:22
|
39 | 39 | |
|
40 | 40 | LL | println!("{:p}", zst_ref);
|
41 |
| - | ^^^^^^^ |
| 41 | + | ^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
42 | 42 |
|
43 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 43 | +warning: taking a reference to a function item does not give a function pointer |
44 | 44 | --> $DIR/function-item-references.rs:88:22
|
45 | 45 | |
|
46 | 46 | LL | println!("{:p}", cast_zst_ptr);
|
47 |
| - | ^^^^^^^^^^^^ |
| 47 | + | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
48 | 48 |
|
49 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 49 | +warning: taking a reference to a function item does not give a function pointer |
50 | 50 | --> $DIR/function-item-references.rs:90:22
|
51 | 51 | |
|
52 | 52 | LL | println!("{:p}", coerced_zst_ptr);
|
53 |
| - | ^^^^^^^^^^^^^^^ |
| 53 | + | ^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
54 | 54 |
|
55 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 55 | +warning: taking a reference to a function item does not give a function pointer |
56 | 56 | --> $DIR/function-item-references.rs:93:22
|
57 | 57 | |
|
58 | 58 | LL | println!("{:p}", &fn_item);
|
59 |
| - | ^^^^^^^^ |
| 59 | + | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
60 | 60 |
|
61 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 61 | +warning: taking a reference to a function item does not give a function pointer |
62 | 62 | --> $DIR/function-item-references.rs:95:22
|
63 | 63 | |
|
64 | 64 | LL | println!("{:p}", indirect_ref);
|
65 |
| - | ^^^^^^^^^^^^ |
| 65 | + | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
66 | 66 |
|
67 |
| -warning: cast `nop` with `as fn()` to obtain a function pointer |
| 67 | +warning: taking a reference to a function item does not give a function pointer |
68 | 68 | --> $DIR/function-item-references.rs:98:22
|
69 | 69 | |
|
70 | 70 | LL | println!("{:p}", &nop);
|
71 |
| - | ^^^^ |
| 71 | + | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` |
72 | 72 |
|
73 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 73 | +warning: taking a reference to a function item does not give a function pointer |
74 | 74 | --> $DIR/function-item-references.rs:100:22
|
75 | 75 | |
|
76 | 76 | LL | println!("{:p}", &bar);
|
77 |
| - | ^^^^ |
| 77 | + | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
78 | 78 |
|
79 |
| -warning: cast `baz` with `as fn(_, _) -> _` to obtain a function pointer |
| 79 | +warning: taking a reference to a function item does not give a function pointer |
80 | 80 | --> $DIR/function-item-references.rs:102:22
|
81 | 81 | |
|
82 | 82 | LL | println!("{:p}", &baz);
|
83 |
| - | ^^^^ |
| 83 | + | ^^^^ help: cast `baz` to obtain a function pointer: `baz as fn(_, _) -> _` |
84 | 84 |
|
85 |
| -warning: cast `unsafe_fn` with `as unsafe fn()` to obtain a function pointer |
| 85 | +warning: taking a reference to a function item does not give a function pointer |
86 | 86 | --> $DIR/function-item-references.rs:104:22
|
87 | 87 | |
|
88 | 88 | LL | println!("{:p}", &unsafe_fn);
|
89 |
| - | ^^^^^^^^^^ |
| 89 | + | ^^^^^^^^^^ help: cast `unsafe_fn` to obtain a function pointer: `unsafe_fn as unsafe fn()` |
90 | 90 |
|
91 |
| -warning: cast `c_fn` with `as extern "C" fn()` to obtain a function pointer |
| 91 | +warning: taking a reference to a function item does not give a function pointer |
92 | 92 | --> $DIR/function-item-references.rs:106:22
|
93 | 93 | |
|
94 | 94 | LL | println!("{:p}", &c_fn);
|
95 |
| - | ^^^^^ |
| 95 | + | ^^^^^ help: cast `c_fn` to obtain a function pointer: `c_fn as extern "C" fn()` |
96 | 96 |
|
97 |
| -warning: cast `unsafe_c_fn` with `as unsafe extern "C" fn()` to obtain a function pointer |
| 97 | +warning: taking a reference to a function item does not give a function pointer |
98 | 98 | --> $DIR/function-item-references.rs:108:22
|
99 | 99 | |
|
100 | 100 | LL | println!("{:p}", &unsafe_c_fn);
|
101 |
| - | ^^^^^^^^^^^^ |
| 101 | + | ^^^^^^^^^^^^ help: cast `unsafe_c_fn` to obtain a function pointer: `unsafe_c_fn as unsafe extern "C" fn()` |
102 | 102 |
|
103 |
| -warning: cast `variadic` with `as unsafe extern "C" fn(_, ...)` to obtain a function pointer |
| 103 | +warning: taking a reference to a function item does not give a function pointer |
104 | 104 | --> $DIR/function-item-references.rs:110:22
|
105 | 105 | |
|
106 | 106 | LL | println!("{:p}", &variadic);
|
107 |
| - | ^^^^^^^^^ |
| 107 | + | ^^^^^^^^^ help: cast `variadic` to obtain a function pointer: `variadic as unsafe extern "C" fn(_, ...)` |
108 | 108 |
|
109 |
| -warning: cast `var` with `as fn(_) -> _` to obtain a function pointer |
| 109 | +warning: taking a reference to a function item does not give a function pointer |
110 | 110 | --> $DIR/function-item-references.rs:112:22
|
111 | 111 | |
|
112 | 112 | LL | println!("{:p}", &std::env::var::<String>);
|
113 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 113 | + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `var` to obtain a function pointer: `var as fn(_) -> _` |
114 | 114 |
|
115 |
| -warning: cast `nop` with `as fn()` to obtain a function pointer |
| 115 | +warning: taking a reference to a function item does not give a function pointer |
116 | 116 | --> $DIR/function-item-references.rs:115:32
|
117 | 117 | |
|
118 | 118 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
119 |
| - | ^^^^ |
| 119 | + | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()` |
120 | 120 |
|
121 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 121 | +warning: taking a reference to a function item does not give a function pointer |
122 | 122 | --> $DIR/function-item-references.rs:115:38
|
123 | 123 | |
|
124 | 124 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
125 |
| - | ^^^^ |
| 125 | + | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
126 | 126 |
|
127 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 127 | +warning: taking a reference to a function item does not give a function pointer |
128 | 128 | --> $DIR/function-item-references.rs:115:44
|
129 | 129 | |
|
130 | 130 | LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
|
131 |
| - | ^^^^ |
| 131 | + | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
132 | 132 |
|
133 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 133 | +warning: taking a reference to a function item does not give a function pointer |
134 | 134 | --> $DIR/function-item-references.rs:130:41
|
135 | 135 | |
|
136 | 136 | LL | std::mem::transmute::<_, usize>(&foo);
|
137 |
| - | ^^^^ |
| 137 | + | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
138 | 138 |
|
139 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 139 | +warning: taking a reference to a function item does not give a function pointer |
140 | 140 | --> $DIR/function-item-references.rs:132:50
|
141 | 141 | |
|
142 | 142 | LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
|
143 |
| - | ^^^^^^^^^^^^ |
| 143 | + | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
144 | 144 |
|
145 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 145 | +warning: taking a reference to a function item does not give a function pointer |
146 | 146 | --> $DIR/function-item-references.rs:132:50
|
147 | 147 | |
|
148 | 148 | LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
|
149 |
| - | ^^^^^^^^^^^^ |
| 149 | + | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
150 | 150 |
|
151 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 151 | +warning: taking a reference to a function item does not give a function pointer |
152 | 152 | --> $DIR/function-item-references.rs:142:15
|
153 | 153 | |
|
154 | 154 | LL | print_ptr(&bar);
|
155 |
| - | ^^^^ |
| 155 | + | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
156 | 156 |
|
157 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 157 | +warning: taking a reference to a function item does not give a function pointer |
158 | 158 | --> $DIR/function-item-references.rs:144:24
|
159 | 159 | |
|
160 | 160 | LL | bound_by_ptr_trait(&bar);
|
161 |
| - | ^^^^ |
| 161 | + | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
162 | 162 |
|
163 |
| -warning: cast `bar` with `as fn(_) -> _` to obtain a function pointer |
| 163 | +warning: taking a reference to a function item does not give a function pointer |
164 | 164 | --> $DIR/function-item-references.rs:146:30
|
165 | 165 | |
|
166 | 166 | LL | bound_by_ptr_trait_tuple((&foo, &bar));
|
167 |
| - | ^^^^^^^^^^^^ |
| 167 | + | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _` |
168 | 168 |
|
169 |
| -warning: cast `foo` with `as fn() -> _` to obtain a function pointer |
| 169 | +warning: taking a reference to a function item does not give a function pointer |
170 | 170 | --> $DIR/function-item-references.rs:146:30
|
171 | 171 | |
|
172 | 172 | LL | bound_by_ptr_trait_tuple((&foo, &bar));
|
173 |
| - | ^^^^^^^^^^^^ |
| 173 | + | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _` |
174 | 174 |
|
175 | 175 | warning: 28 warnings emitted
|
176 | 176 |
|
0 commit comments