Skip to content

Empty repr(Rust) enums are ZSTs#2293

Open
zachs18 wants to merge 1 commit into
rust-lang:masterfrom
zachs18:zst-empty-enum
Open

Empty repr(Rust) enums are ZSTs#2293
zachs18 wants to merge 1 commit into
rust-lang:masterfrom
zachs18:zst-empty-enum

Conversation

@zachs18

@zachs18 zachs18 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Guarantee that enums with Rust representation with no variants are ZSTs.

Followup to #2262 , (which guaranteed the same for enums with Rust representation with a single variant whose fields are all ZSTs).

@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Jul 7, 2026
@zachs18 zachs18 marked this pull request as ready for review July 8, 2026 01:46
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jul 8, 2026
@zachs18

zachs18 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

Followup to #2262 to guarantee that zero-variant repr(Rust) enums are zero-sized. Rebased since #2262 merged, using similar phrasing as in that PR.

@rustbot

rustbot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Error: Label T-lang can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@zachs18

zachs18 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

cc @traviscross As per #2262 (comment) , here's a followup PR to extend the ZST guarantee to zero-variant repr(Rust) enums.

@traviscross traviscross added I-lang-nominated Nominated for discussion during a lang team meeting. T-lang Relevant to the language team. needs-fcp P-lang-drag-1 Lang team prioritization drag level 1. labels Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-lang-nominated Nominated for discussion during a lang team meeting. needs-fcp P-lang-drag-1 Lang team prioritization drag level 1. S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. S-waiting-on-review Status: The marked PR is awaiting review from a maintainer T-lang Relevant to the language team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants