1
Fork 0

compiler: Add is_uninhabited and use LayoutS accessors

This reduces the need of the compiler to peek on the fields of LayoutS.
This commit is contained in:
Jubilee Young 2024-10-27 21:34:49 -07:00
parent 5f5c243ca0
commit 88a9edc091
20 changed files with 40 additions and 37 deletions

View file

@ -339,9 +339,7 @@ pub(crate) mod rustc {
// 2. enums that delegate their layout to a variant
// 3. enums with multiple variants
match layout.variants() {
Variants::Single { .. }
if layout.abi.is_uninhabited() && layout.size == Size::ZERO =>
{
Variants::Single { .. } if layout.is_uninhabited() && layout.size == Size::ZERO => {
// The layout representation of uninhabited, ZST enums is
// defined to be like that of the `!` type, as opposed of a
// typical enum. Consequently, they cannot be descended into