-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[derive(...)] for 'extern fn' types #23403
Comments
Note, that
Similar reasons for As a solution, you’ll have to implement all these traits manually and implement your desired behaviour yourself. |
It just seems to me that |
This seems plain wrong, now that Copy inherits from Clone: use std::mem;
type Foo = extern "C" fn() -> i32;
fn main() {
// Get a pointer from a C library.
let a: Foo = unsafe { mem::transmute(15usize) };
let b = a;
let c = a; // Copy works fine
let d = a.clone(); // But Clone (which is a prerequisite for Copy) doesn't?
} Edit: confused inheritance directory. |
When trying to autogenerate Rust bindings from C headers, I came across the problem that I cannot use either
#[derive(Clone)]
or#[derive(Debug)]
withextern fn(...)
types.I would think that the default derivation for
extern fn(...)
types would be the same as raw pointers. Is there something more complex aboutextern fn(...)
types that prevents them being copied and printed as pointers?Meta
The text was updated successfully, but these errors were encountered: