rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.82k stars 263 forks source link

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

Open thinety opened 2 months ago

thinety commented 2 months ago

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.