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

Cython: Omit per-variant tags in unions generated for Rust enums #748

Merged
merged 1 commit into from Mar 31, 2022

Conversation

petrochenkov
Copy link
Contributor

The common tag should already be enough, all other tags are identical to it.
In Cython case they only create noise because the declarations only introduce names and do not determine layouts.

The common `tag` should already be enough, al other tags are identical to it.
In Cython case they only create noise because the declarations only introduce names and do not determine layouts.
if config.language != Language::Cython {
out.write("struct");
out.open_brace();
}
out.write_vertical_source_list(&body.fields, ListType::Cap(";"));
let start_field =
usize::from(inline_tag_field && config.language == Language::Cython);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit subtle, might be a bit clearer with:

let fields_to_write = if inline_tag_field && config.language == Language::Cython {
    &body.fields[1..]
} else {
    &body.fields
};

But sure, fine.

@emilio emilio merged commit ca7a942 into mozilla:master Mar 31, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants