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

Use () instead of [u8; 0] in opaque type #456

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

thinety
Copy link
Contributor

@thinety thinety commented Jul 18, 2024

There once was a comment in the opaque structs section of the FFI chapter which explained that the empty array is used to avoid a warning around () in FFI. Since Rust 1.72, the compiler no longer warns about using () in FFI.

This PR swaps [u8; 0] for () in the example opaque structs to avoid any future confusion.

@JohnTitor JohnTitor force-pushed the unit-in-opaque-type branch from 3401e89 to 38f5394 Compare February 2, 2025 08:32
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks a lot!

@JohnTitor JohnTitor added this pull request to the merge queue Feb 2, 2025
Merged via the queue into rust-lang:master with commit 75eb897 Feb 2, 2025
2 checks passed
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.

3 participants