Skip to content

enum discriminant should only be as big as needed #5024

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

Closed
thestinger opened this issue Feb 19, 2013 · 2 comments
Closed

enum discriminant should only be as big as needed #5024

thestinger opened this issue Feb 19, 2013 · 2 comments

Comments

@thestinger
Copy link
Contributor

I don't think there's any need to make these 64-bit, or even require that they be 32-bit. It's somewhat surprising how big stuff like Option<()> is at the moment. It's very painful for stuff like SmallIntMap and Deque that use ~[Option<T>], and for implementing set types as wrappers around map types.

For compatibility with C code, a #[discriminant = c_int] attribute can be offered to choose whatever primitive integer type is desired (C++11 has this feature too, as class enum foo: uint8_t)

@sanxiyn
Copy link
Member

sanxiyn commented Feb 19, 2013

See #1647 for the past discussion.

@graydon
Copy link
Contributor

graydon commented Mar 14, 2013

Yeah this is a dupe. We have at least 4 bugs open on this.

@graydon graydon closed this as completed Mar 14, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
…lip1995

Match wild err arm improvements

This lint should trigger on other identifiers which have `_` prefix (such as `_e`) and only if they are unused in the panic block.

_Note_: the `is_unused` function is greatly inspired from `pat_is_wild` function in [loops lints](https://github.com/rust-lang/rust-clippy/blob/43ac9416d935942d6c7d2b2e0c876c551652c4ec/clippy_lints/src/loops.rs#L1689).
I've been considering doing some refactoring, maybe in utils. Maybe this PR or a new one. What do you think ?

fixes rust-lang#5024

changelog: none
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

3 participants