The docs about fn says "Function pointers implement the following traits: [...] Pointer". But when I try to use this, I get an error. This is my code:
use std::fmt::Pointer;
fn f() {}
fn main() {
let _: &dyn Pointer = &f as &dyn Pointer;
}
It produces an error when compiling:
error[E0277]: the trait bound `fn() {f}: Pointer` is not satisfied
--> src/main.rs:6:31
|
6 | let _: Box<dyn Pointer> = Box::new(f);
| ^^^^^^^^^^^ the trait `Pointer` is not implemented for `fn() {f}`
|
= note: required for the cast to the object type `dyn Pointer`
Does fn() implement Pointer or not?