-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make struct-like enum variants experimental #9305
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
Comments
accepted backwards-compatible |
By struct-like enum variants do you mean ones with named fields? |
Yeah, this should be experimental: enum A {
Variant1 { foo: int }
} |
Would it be marked experimental because we're not sure if we want to commit to supporting it? As far as I know the implementation is shared with structs in |
I think struct variants have an important use case for variants with many fields. Consider code like this: https://github.com/brson/rust-sdl/blob/master/src/event.rs#L577 and https://github.com/mozilla/rust/blob/master/src/libsyntax/ast.rs#L227 . In both cases they would benefit greatly from having the variant arguments have explicit names, e.g. consider this code from my library which mirrors the rust-sdl use case: https://github.com/SiegeLord/RustAllegro/blob/master/src/events.rs#L79 and https://github.com/SiegeLord/RustAllegro/blob/master/example.rs#L39 . It seems a lot clearer than the equivalent rust-sdl code: https://github.com/brson/rust-sdl/blob/master/demo/video.rs#L38 . |
I've also found these extremely useful, especially in cases like https://github.com/sfackler/rust-postgres/blob/master/src/message.rs#L73 |
The thinking was that they were broken. Maybe they aren't. |
A few features are now hidden behind various #[feature(...)] directives. These include struct-like enum variants, glob imports, and macro_rules! invocations. Closes rust-lang#9304 Closes rust-lang#9305 Closes rust-lang#9306 Closes rust-lang#9331
) Closes rust-lang#13306 Closes rust-lang#9925 Closes rust-lang#9470 Closes rust-lang#9305 Clippy gives wrong suggestions when the key is not `Copy`. As suggested in rust-lang#9925, in such cases Clippy will simply warn but no fix. changelog: [`map_entry`]: fix wrong suggestions when key is not `Copy`
Using #9304.
Nominating backcompat.
The text was updated successfully, but these errors were encountered: