1 warning: taking a reference to a function item does not give a function pointer
2 --> $DIR/function-item-references.rs:44:18
4 LL | Pointer::fmt(&zst_ref, f)
5 | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
7 note: the lint level is defined here
8 --> $DIR/function-item-references.rs:3:9
10 LL | #![warn(function_item_references)]
11 | ^^^^^^^^^^^^^^^^^^^^^^^^
13 warning: taking a reference to a function item does not give a function pointer
14 --> $DIR/function-item-references.rs:81:22
16 LL | println!("{:p}", &foo);
17 | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
19 warning: taking a reference to a function item does not give a function pointer
20 --> $DIR/function-item-references.rs:83:20
22 LL | print!("{:p}", &foo);
23 | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
25 warning: taking a reference to a function item does not give a function pointer
26 --> $DIR/function-item-references.rs:85:21
28 LL | format!("{:p}", &foo);
29 | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
31 warning: taking a reference to a function item does not give a function pointer
32 --> $DIR/function-item-references.rs:88:22
34 LL | println!("{:p}", &foo as *const _);
35 | ^^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
37 warning: taking a reference to a function item does not give a function pointer
38 --> $DIR/function-item-references.rs:90:22
40 LL | println!("{:p}", zst_ref);
41 | ^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
43 warning: taking a reference to a function item does not give a function pointer
44 --> $DIR/function-item-references.rs:92:22
46 LL | println!("{:p}", cast_zst_ptr);
47 | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
49 warning: taking a reference to a function item does not give a function pointer
50 --> $DIR/function-item-references.rs:94:22
52 LL | println!("{:p}", coerced_zst_ptr);
53 | ^^^^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
55 warning: taking a reference to a function item does not give a function pointer
56 --> $DIR/function-item-references.rs:97:22
58 LL | println!("{:p}", &fn_item);
59 | ^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
61 warning: taking a reference to a function item does not give a function pointer
62 --> $DIR/function-item-references.rs:99:22
64 LL | println!("{:p}", indirect_ref);
65 | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
67 warning: taking a reference to a function item does not give a function pointer
68 --> $DIR/function-item-references.rs:102:22
70 LL | println!("{:p}", &nop);
71 | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()`
73 warning: taking a reference to a function item does not give a function pointer
74 --> $DIR/function-item-references.rs:104:22
76 LL | println!("{:p}", &bar);
77 | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
79 warning: taking a reference to a function item does not give a function pointer
80 --> $DIR/function-item-references.rs:106:22
82 LL | println!("{:p}", &baz);
83 | ^^^^ help: cast `baz` to obtain a function pointer: `baz as fn(_, _) -> _`
85 warning: taking a reference to a function item does not give a function pointer
86 --> $DIR/function-item-references.rs:108:22
88 LL | println!("{:p}", &unsafe_fn);
89 | ^^^^^^^^^^ help: cast `unsafe_fn` to obtain a function pointer: `unsafe_fn as unsafe fn()`
91 warning: taking a reference to a function item does not give a function pointer
92 --> $DIR/function-item-references.rs:110:22
94 LL | println!("{:p}", &c_fn);
95 | ^^^^^ help: cast `c_fn` to obtain a function pointer: `c_fn as extern "C" fn()`
97 warning: taking a reference to a function item does not give a function pointer
98 --> $DIR/function-item-references.rs:112:22
100 LL | println!("{:p}", &unsafe_c_fn);
101 | ^^^^^^^^^^^^ help: cast `unsafe_c_fn` to obtain a function pointer: `unsafe_c_fn as unsafe extern "C" fn()`
103 warning: taking a reference to a function item does not give a function pointer
104 --> $DIR/function-item-references.rs:114:22
106 LL | println!("{:p}", &variadic);
107 | ^^^^^^^^^ help: cast `variadic` to obtain a function pointer: `variadic as unsafe extern "C" fn(_, ...)`
109 warning: taking a reference to a function item does not give a function pointer
110 --> $DIR/function-item-references.rs:116:22
112 LL | println!("{:p}", &take_generic_ref::<u32>);
113 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_ref` to obtain a function pointer: `take_generic_ref::<u32> as fn(_)`
115 warning: taking a reference to a function item does not give a function pointer
116 --> $DIR/function-item-references.rs:118:22
118 LL | println!("{:p}", &take_generic_array::<u32, 4>);
119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_array` to obtain a function pointer: `take_generic_array::<u32, 4> as fn(_)`
121 warning: taking a reference to a function item does not give a function pointer
122 --> $DIR/function-item-references.rs:120:22
124 LL | println!("{:p}", &multiple_generic::<u32, f32>);
125 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `multiple_generic` to obtain a function pointer: `multiple_generic::<u32, f32> as fn(_, _)`
127 warning: taking a reference to a function item does not give a function pointer
128 --> $DIR/function-item-references.rs:122:22
130 LL | println!("{:p}", &multiple_generic_arrays::<u32, f32, 4, 8>);
131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `multiple_generic_arrays` to obtain a function pointer: `multiple_generic_arrays::<u32, f32, 4, 8> as fn(_, _)`
133 warning: taking a reference to a function item does not give a function pointer
134 --> $DIR/function-item-references.rs:124:22
136 LL | println!("{:p}", &std::env::var::<String>);
137 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `var` to obtain a function pointer: `var::<String> as fn(_) -> _`
139 warning: taking a reference to a function item does not give a function pointer
140 --> $DIR/function-item-references.rs:127:32
142 LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
143 | ^^^^ help: cast `nop` to obtain a function pointer: `nop as fn()`
145 warning: taking a reference to a function item does not give a function pointer
146 --> $DIR/function-item-references.rs:127:38
148 LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
149 | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
151 warning: taking a reference to a function item does not give a function pointer
152 --> $DIR/function-item-references.rs:127:44
154 LL | println!("{:p} {:p} {:p}", &nop, &foo, &bar);
155 | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
157 warning: taking a reference to a function item does not give a function pointer
158 --> $DIR/function-item-references.rs:142:41
160 LL | std::mem::transmute::<_, usize>(&foo);
161 | ^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
163 warning: taking a reference to a function item does not give a function pointer
164 --> $DIR/function-item-references.rs:144:50
166 LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
167 | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
169 warning: taking a reference to a function item does not give a function pointer
170 --> $DIR/function-item-references.rs:144:50
172 LL | std::mem::transmute::<_, (usize, usize)>((&foo, &bar));
173 | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
175 warning: taking a reference to a function item does not give a function pointer
176 --> $DIR/function-item-references.rs:147:41
178 LL | std::mem::transmute::<_, usize>(&take_generic_ref::<u32>);
179 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: cast `take_generic_ref` to obtain a function pointer: `take_generic_ref::<u32> as fn(_)`
181 warning: taking a reference to a function item does not give a function pointer
182 --> $DIR/function-item-references.rs:156:15
184 LL | print_ptr(&bar);
185 | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
187 warning: taking a reference to a function item does not give a function pointer
188 --> $DIR/function-item-references.rs:158:24
190 LL | bound_by_ptr_trait(&bar);
191 | ^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
193 warning: taking a reference to a function item does not give a function pointer
194 --> $DIR/function-item-references.rs:160:30
196 LL | bound_by_ptr_trait_tuple((&foo, &bar));
197 | ^^^^^^^^^^^^ help: cast `bar` to obtain a function pointer: `bar as fn(_) -> _`
199 warning: taking a reference to a function item does not give a function pointer
200 --> $DIR/function-item-references.rs:160:30
202 LL | bound_by_ptr_trait_tuple((&foo, &bar));
203 | ^^^^^^^^^^^^ help: cast `foo` to obtain a function pointer: `foo as fn() -> _`
205 warning: 33 warnings emitted