about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/Linker.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-04 18:16:22 +0200
committerGitHub <noreply@github.com>2024-07-04 18:16:22 +0200
commitf0a0f8f7e8adae3f5abf945af9c9f3b2f95af43b (patch)
tree7e4c968a3cf59040a841a1648ff576be464ec65e /compiler/rustc_llvm/llvm-wrapper/Linker.cpp
parente2cf31a6148725bde4ea48acf1e4fe72675257a2 (diff)
parent8a3c07afbe94ff892b9fef982dea3ba1af7c7a5a (diff)
downloadrust-f0a0f8f7e8adae3f5abf945af9c9f3b2f95af43b.tar.gz
rust-f0a0f8f7e8adae3f5abf945af9c9f3b2f95af43b.zip
Rollup merge of #123043 - GoldsteinE:fix/repr-c-dead-branches, r=oli-obk
Disable dead variant removal for `#[repr(C)]` enums.

This prevents removing dead branches from a `#[repr(C)]` enum (they now get discriminants allocated as if they were inhabited).

Implementation notes: ABI of something like

```rust
#[repr(C)]
enum Foo {
    Foo(!),
}
```

is still `Uninhabited`, but its layout is now computed as if all the branches were inhabited.
This seemed to me like a proper way to do it, especially given that ABI sanity check explicitly asserts that type-level uninhabitedness implies ABI uninhabitedness.

This probably needs some sort of FCP (given that it changes `#[repr(C)]` layout, which is a stable guarantee), but I’m not sure how to call for one or which team is the most relevant.

See https://github.com/rust-lang/unsafe-code-guidelines/issues/500.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/Linker.cpp')
0 files changed, 0 insertions, 0 deletions