erlang_nif-sys icon indicating copy to clipboard operation
erlang_nif-sys copied to clipboard

ErlNifEnv should be an empty type

Open nox opened this issue 6 years ago • 3 comments

It is supposed to be opaque. It should at least be of size 0.

nox avatar Nov 18 '17 10:11 nox

The dummy member is not pub; where are you seeing it not be opaque?

  1. The dummy pointer member disables Send and Sync. There are other ways in unstable Rust.

  2. Also at the time of writing I recall an error or warning for empty structs. The recommended alternative was to use an empty enum, but I didn't like the way ErlNifEnv listed an enum in the docs, so stuck with struct. I suspect this may have changed in current Rust.

When both points above can be resolved in stable Rust I'll happily make the struct size 0.

goertzenator avatar Nov 18 '17 14:11 goertzenator

what the status of this?

benoitc avatar Mar 17 '19 08:03 benoitc

Unless there's some concrete issue with the current implementation this should be closed.

goertzenator avatar Mar 17 '19 17:03 goertzenator