Skip to content
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

Debug not implemeted for function pointers #1271

Closed
gkoz opened this issue Sep 5, 2015 · 4 comments
Closed

Debug not implemeted for function pointers #1271

gkoz opened this issue Sep 5, 2015 · 4 comments

Comments

@gkoz
Copy link

gkoz commented Sep 5, 2015

extern fn foo() { }

fn main() {
    let ext: extern fn() = foo;
    let f: fn() = main;
    print!("{:?} {:?} {:?} {:?}", ext, foo, f, main);
}
<anon>:6:35: 6:38 error: the trait `core::fmt::Debug` is not implemented for the type `extern "C" fn()` [E0277]
<anon>:6     print!("{:?} {:?} {:?} {:?}", ext, foo, f, main);
                                           ^~~
<anon>:6:40: 6:43 error: the trait `core::fmt::Debug` is not implemented for the type `extern "C" fn() {foo}` [E0277]
<anon>:6     print!("{:?} {:?} {:?} {:?}", ext, foo, f, main);
                                                ^~~
<anon>:6:45: 6:46 error: the trait `core::fmt::Debug` is not implemented for the type `fn()` [E0277]
<anon>:6     print!("{:?} {:?} {:?} {:?}", ext, foo, f, main);
                                                     ^
<anon>:6:48: 6:52 error: the trait `core::fmt::Debug` is not implemented for the type `fn() {main}` [E0277]
<anon>:6     print!("{:?} {:?} {:?} {:?}", ext, foo, f, main);
                                                        ^~~~

While it might be possible to explain away the last three errors, the first one makes it impossible to derive Debug for structs that contain C callbacks.

@petrochenkov
Copy link
Contributor

rust-lang/rust#26082

@gkoz
Copy link
Author

gkoz commented Sep 5, 2015

@petrochenkov
Thanks.
So it seems the general situation is gloomy but the extern "C" fns that don't use references could still get their impls.

@petrochenkov
Copy link
Contributor

Resolved by rust-lang/rust#28268

@alexcrichton
Copy link
Member

Thanks @petrochenkov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants