Closed
Description
This fails to compile:
#[derive(Debug)]
pub struct A {
f: fn(&i64),
}
Compiling no-debug v0.1.0 (file:///home/boeckb/misc/code/sb/rs-no-debug)
error[E0277]: the trait bound `fn(&i64): std::fmt::Debug` is not satisfied
--> src/lib.rs:3:5
|
3 | f: fn(&i64),
| ^^^^^^^^^^^ `fn(&i64)` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
|
= help: the trait `std::fmt::Debug` is not implemented for `fn(&i64)`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&fn(&i64)`
= note: required for the cast to the object type `std::fmt::Debug`
error: aborting due to previous error
It does work if the parameter is a non-reference (mutable reference also fails) including pointers. I'm using rustc 1.20.0 from Fedora's packages.