Skip to content

Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).#146989

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zachs18:fix-146984
Mar 1, 2026
Merged

Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).#146989
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zachs18:fix-146984

Conversation

@zachs18
Copy link
Contributor

@zachs18 zachs18 commented Sep 24, 2025

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@theemathas
Copy link
Contributor

Does this need a T-lang FCP?

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@SparrowLii
Copy link
Member

SparrowLii commented Sep 30, 2025

This looks fine to me. I'd like at least someone from t-lang to have a aware

r? lang

@rustbot rustbot added the T-lang Relevant to the language team label Sep 30, 2025
@rustbot rustbot assigned nikomatsakis and unassigned SparrowLii Sep 30, 2025
@zachs18
Copy link
Contributor Author

zachs18 commented Nov 10, 2025

@nikomatsakis Friendly ping. Does this need a T-lang FCP?

@zachs18
Copy link
Contributor Author

zachs18 commented Jan 4, 2026

@rustbot label I-lang-nominated

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Jan 4, 2026
@traviscross traviscross added the P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang label Jan 7, 2026
@Nadrieril
Copy link
Member

For context, repr.inhibit_enum_layout_opt() means repr.c() || repr.int.is_some() today.

@traviscross
Copy link
Contributor

@bors2 try

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 7, 2026

Unknown command "2". Run @bors help to see available commands.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Jan 7, 2026
Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).
@joshtriplett joshtriplett added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 7, 2026
@joshtriplett
Copy link
Member

We talked about this in today's @rust-lang/lang meeting.

repr(int) (e.g. repr(u32)) does have some layout guarantees, and we were not meeting those guarantees. This could affect the layout of real structures. (Even though the enum in question would have to be uninhabited, it could appear somewhere that affects the size of an overall inhabited type, such as a union variant or enum variant.)

We'd like to evaluate making this change. It'll need relnotes (in the compatibility section), and we should also ping some of the folks who do creative serialization/deserialization stunts (e.g. zerocopy, rkyv) to find out if they might be affected by this.

@rfcbot merge lang
@rfcbot concern crater

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Jan 7, 2026

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jan 7, 2026
@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Feb 6, 2026
@zachs18
Copy link
Contributor Author

zachs18 commented Feb 6, 2026

Seems like all the retried regression results were the same as before. None seem related.

regressions

Crates.io:

Probably flaky

  • netupi-core - probably flaky test (multiple tests use PersistenceManager::new(), which uses the same files every time, and some tests call PersistenceManager::save_config which writes to one of the files)
  • nostalgia - probably flaky test (multiple doctests use Storage::new("/tmp/db"), including the doctest for delete)
  • pswatch - probably flaky test (assumes that a sleep 5 process has not completed after std::thread::sleep(1 second))

Unknown, but probaly flaky

  • swarc - idk, but doesn't use repr

Github regressions (all flaky or probably flaky):

  • isgasho/openforum and lann/code-snippets - probably unrelated build issue - duplicate symbol canonical_abi_free, does not use repr
    • maybe due to old version of wit-bindgen-rust(?) (0.1.0 vs 0.52.0 latest)
  • luansilvadb/backend_pbx - probably flaky, tests set env vars, doesn't use repr
  • Lucian-4a25/rust-sort-algorithm - flaky, reproducible on nightly (incorrect custom sorting algorithm implementation)
  • OldSinner/rs-json-handler - flaky, reproducible on stable (hashmap iteration order)
  • rwcrosby/ncexe - probably flaky "Err value: Colors not supported" I assume crater's terminal doesn't support colors
  • Sigrhofundr/exam_20250703 - probably flaky, timeout with multithreading and no synchronization, doesn't use repr
  • teschmitt/bzippr - flaky, reproducible on stable

@rustbot label I-lang-nominated

@rustbot rustbot added the I-lang-nominated Nominated for discussion during a lang team meeting. label Feb 10, 2026
@joshtriplett
Copy link
Member

@rfcbot resolve crater

Thank you for the analysis!

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Feb 11, 2026
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Feb 21, 2026
@rust-rfcbot
Copy link
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@rust-rfcbot rust-rfcbot added the to-announce Announce this issue on triage meeting label Feb 21, 2026
@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Feb 22, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Feb 28, 2026

This was approved and the FCP was completed successfully. I suppose it's time to merge it

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 28, 2026

📌 Commit 85872cf has been approved by Kivooeo

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 28, 2026
@Kivooeo
Copy link
Member

Kivooeo commented Feb 28, 2026

Let me do this more accurate

@bors r-

@bors r=SparrowLii

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 28, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 28, 2026

📌 Commit 85872cf has been approved by SparrowLii

It is now in the queue for this repository.

rust-bors bot pushed a commit that referenced this pull request Feb 28, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #146989 (Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).)
 - #151991 (std: sys: pal: uefi: os: Implement split_paths)
 - #152794 (Fix ICE in `try_to_raw_bytes` when array elements have mismatched)
 - #153052 (std random.rs: update link to RTEMS docs)
 - #153054 (docs: note env var influence on `temp_dir` and `env_clear` on Windows)
 - #153061 (cleanup `tests/ui/box`, part 2)
 - #153197 (style: Update doctests for `TryFrom<integer> for bool` and `From<bool> for float`)
 - #153210 (Fix ICE on empty file with -Zquery-dep-graph)
 - #153228 (Remove `TranslationError`)
@traviscross
Copy link
Contributor

Cc @rust-lang/lang-docs @rust-lang/fls

@rust-bors rust-bors bot merged commit b42920d into rust-lang:main Mar 1, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 1, 2026
@rustbot rustbot added this to the 1.96.0 milestone Mar 1, 2026
rust-timer added a commit that referenced this pull request Mar 1, 2026
Rollup merge of #146989 - zachs18:fix-146984, r=SparrowLii

Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/146989)*

Fixes #146984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. needs-crater This change needs a crater run to check for possible breakage in the ecosystem. relnotes Marks issues that should be documented in the release notes of the next release. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uninhabited repr(uX) enum shouldn't have size zero