Skip to content

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

Closed
@koba-e964

Description

@koba-e964

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions