diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-10-27 21:34:49 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-10-28 09:58:30 -0700 |
| commit | 88a9edc091fad78a8e3784fe656e369417bb6acc (patch) | |
| tree | 2fb538fde3e05d71fa7bb9dfeafffb3ee483e81f /compiler/rustc_ty_utils/src/layout/invariant.rs | |
| parent | 5f5c243ca020e45cb6ee48a1f635a929eb611fd2 (diff) | |
| download | rust-88a9edc091fad78a8e3784fe656e369417bb6acc.tar.gz rust-88a9edc091fad78a8e3784fe656e369417bb6acc.zip | |
compiler: Add `is_uninhabited` and use LayoutS accessors
This reduces the need of the compiler to peek on the fields of LayoutS.
Diffstat (limited to 'compiler/rustc_ty_utils/src/layout/invariant.rs')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout/invariant.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_ty_utils/src/layout/invariant.rs b/compiler/rustc_ty_utils/src/layout/invariant.rs index 6cf114b74c1..3db5a4f1805 100644 --- a/compiler/rustc_ty_utils/src/layout/invariant.rs +++ b/compiler/rustc_ty_utils/src/layout/invariant.rs @@ -10,7 +10,7 @@ pub(super) fn partially_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLa // Type-level uninhabitedness should always imply ABI uninhabitedness. if layout.ty.is_privately_uninhabited(tcx, cx.param_env) { - assert!(layout.abi.is_uninhabited()); + assert!(layout.is_uninhabited()); } if layout.size.bytes() % layout.align.abi.bytes() != 0 { @@ -262,9 +262,7 @@ pub(super) fn partially_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLa ) } // Skip empty variants. - if variant.size == Size::ZERO - || variant.fields.count() == 0 - || variant.abi.is_uninhabited() + if variant.size == Size::ZERO || variant.fields.count() == 0 || variant.is_uninhabited() { // These are never actually accessed anyway, so we can skip the coherence check // for them. They also fail that check, since they have |
