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

Compile-time check for repr(c) on param structs #6

Open
mullr opened this issue May 9, 2019 · 0 comments
Open

Compile-time check for repr(c) on param structs #6

mullr opened this issue May 9, 2019 · 0 comments

Comments

@mullr
Copy link
Collaborator

mullr commented May 9, 2019

  • Make this a separate crate - we'll open source it!
  • Make a ReprCCompatible trait
  • Implement the trait on primitive types
  • Make a derive macro which implements the trait and generates static assertions
    about the struct members.
  // IN
  #[derive(ABI)]
  struct Foo {
    x: MyThing
  }

  // OUT
  #[repr(C)]
  struct Foo {
      x: MyThing
  }

  impl ABI for Foo {
      fn _hidden_static_asserts() {
          assert_impl!(MyThing, ABI);
      }
  }
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

1 participant