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

ErlNifCharEncoding's DUMMY variant may be no longer necessary #385

Closed
koba-e964 opened this issue Sep 27, 2021 · 1 comment
Closed

ErlNifCharEncoding's DUMMY variant may be no longer necessary #385

koba-e964 opened this issue Sep 27, 2021 · 1 comment

Comments

@koba-e964
Copy link

koba-e964 commented Sep 27, 2021

enum ErlNifCharEncoding has the DUMMY variant to prevent a "univariant enum" compile error from happening.

/// See [ErlNifCharEncoding](http://www.erlang.org/doc/man/erl_nif.html#ErlNifCharEncoding) in the Erlang docs.
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub enum ErlNifCharEncoding {
ERL_NIF_LATIN1 = 1,
DUMMY = 999, // prevents "univariant enum" compile error
}

But this enum without this DUMMY variant no longer emits a compile error with the latest stable release of rustc.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ee80075ae7081fe3e634f8cb402e45df

I believe that this "univariant enum" issue was fixed in rust-lang/rust#33355, which landed in rustc 1.10.0 (2016-07-07). Maybe we can mark the DUMMY variant as deprecated and remove it in the next release.

@filmor
Copy link
Member

filmor commented Oct 11, 2021

This was fixed in #390, thank you for the hint :)

@filmor filmor closed this as completed Oct 11, 2021
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