about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/context.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-29 10:22:35 +0000
committerbors <bors@rust-lang.org>2023-08-29 10:22:35 +0000
commit0b84f18b24c8cb9a2f83b21c0d93c54ea4bb76e8 (patch)
treee5f7c93b0f589b0aaee74b7ddbfd40a5d662d76c /compiler/rustc_codegen_llvm/src/context.rs
parentf6faef447536204549eb47f12884d3e229fe87d3 (diff)
parentb2ebf1c23f93886ba7d3738878f04e275add4ead (diff)
downloadrust-0b84f18b24c8cb9a2f83b21c0d93c54ea4bb76e8.tar.gz
rust-0b84f18b24c8cb9a2f83b21c0d93c54ea4bb76e8.zip
Auto merge of #115277 - RalfJung:is_1zst, r=davidtwco
fix some issues around ZST handling

This fixes two bugs:
- We used to entirely skip enum variants like `B([u16; 0], !)`, even failing to properly align the enum!  Honoring the alignment of uninhabited variants is important for the same reason that we must reserve space for their fields -- see [here](https://github.com/rust-lang/rust/issues/49298#issuecomment-380615281) for why.
- ~~We uses to reject `repr(transparent)` on `struct MyType([u16; 0])`, which is weird because a one-field struct should always be allowed to be transparent around that field.~~ (moved to separate PR)

I also found two places in the layout code that did something special for ZST without explaining why, and removing those special cases doesn't seem to have any effect except for reordering some zero-sized fields which shouldn't be an issue... maybe PR CI will explain why those cases were needed, or maybe they became obsolete at some point.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
0 files changed, 0 insertions, 0 deletions