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

Don't allow construction of non-POD types from Rust #25

Merged
merged 3 commits into from
Oct 12, 2020

Conversation

adetaylor
Copy link
Collaborator

Fixes #23

Copy link
Contributor

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. You might also consider making them non-Sync, since as implemented here, safe Rust code could wrongly move a &NonPod from one thread to another despite one of the fields in C++ not being thread-safe.

https://github.com/dtolnay/cxx/blob/9e457018915999ca26b372e9291a0793f0b5fdaa/src/opaque.rs has an implementation with what I think are the right default properties.

@adetaylor adetaylor merged commit 49c8fb8 into main Oct 12, 2020
@adetaylor
Copy link
Collaborator Author

Thanks!

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

Successfully merging this pull request may close these issues.

Struct with non-POD fields can be improperly constructed from Rust
2 participants