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

Poor error message with #[warn(ctypes)] #16784

Closed
mrmonday opened this issue Aug 27, 2014 · 1 comment
Closed

Poor error message with #[warn(ctypes)] #16784

mrmonday opened this issue Aug 27, 2014 · 1 comment

Comments

@mrmonday
Copy link
Contributor

The following code:

pub struct Bar;
#[repr(C)]
pub struct Foo {
    bar: Bar
}

extern {
    pub fn extern_func(foo: Foo);
}

fn main() {
}

(Playpen: http://is.gd/ANqwz9)

Gives the error:

<anon>:8:29: 8:32 warning: found type without foreign-function-safe
                                             representation annotation in foreign module, consider adding a #[repr(...)] attribute to the type, #[warn(ctypes)] on by default
<anon>:8     pub fn extern_func(foo: Foo);
                                     ^~~

Despite Foo being marked as #[repr(C)]. This should either:

  • Include a note specifying which part of Foo is causing it to not be repr(C), or
  • Cause an error, since Foo is not repr(C), despite being marked as such.
@huonw
Copy link
Member

huonw commented Aug 27, 2014

Dupe of #16719. (Thanks for filing!)

@huonw huonw closed this as completed Aug 27, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 17, 2024
internal: Remove synstructure const hack support

The latest version of it no longer emits these
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

2 participants