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

#[repr(C)] and UnsafeCell #5

Open
seeday opened this issue Dec 13, 2016 · 1 comment
Open

#[repr(C)] and UnsafeCell #5

seeday opened this issue Dec 13, 2016 · 1 comment

Comments

@seeday
Copy link

seeday commented Dec 13, 2016

In the WO struct you use an UnsafeCell to hold the value, but UnsafeCell isn't repr(C) compatible. This causes rust to throw a warning that some struct element isn't repr(C) and should be.

I'm unsure whether or not this breaks things in practice, so what's the fix here, if any? My fork just made it work like RW structs, but would require a minor change to svd2rust (all write functions use mutable borrows).

@japaric
Copy link
Member

japaric commented Dec 14, 2016

This causes rust to throw a warning that some struct element isn't repr(C) and should be.

In what cases does it throw a warning? FFI boundary?

I'm unsure whether or not this breaks things in practice

Now that we don't have "drop flags", it doesn't.

what's the fix here, if any?

We could mark UnsafeCell, itself, as repr(C).

My fork just made it work like RW structs,

For now, I'd rather not change the API of only WO. I want to review the whole API in the (near?) future.

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