diff options
| author | Ralf Jung <post@ralfj.de> | 2024-12-01 17:33:01 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-12-18 11:01:54 +0100 |
| commit | e023590de407f417e0f3da675a372eca7acf60c6 (patch) | |
| tree | 1250b36437667439bc369777a202d9571cec2f19 /compiler/rustc_ty_utils/src/layout/invariant.rs | |
| parent | 21de42bf8ddd0f39c766c7705990152302ae1f3b (diff) | |
| download | rust-e023590de407f417e0f3da675a372eca7acf60c6.tar.gz rust-e023590de407f417e0f3da675a372eca7acf60c6.zip | |
make no-variant types a dedicated Variants variant
Diffstat (limited to 'compiler/rustc_ty_utils/src/layout/invariant.rs')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout/invariant.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_ty_utils/src/layout/invariant.rs b/compiler/rustc_ty_utils/src/layout/invariant.rs index 7e2375154c0..8d5403ed324 100644 --- a/compiler/rustc_ty_utils/src/layout/invariant.rs +++ b/compiler/rustc_ty_utils/src/layout/invariant.rs @@ -242,15 +242,15 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou check_layout_abi(cx, layout); match &layout.variants { - Variants::Single { index: None } => { + Variants::Empty => { assert!(layout.is_uninhabited()); } - Variants::Single { index: Some(idx) } => { + Variants::Single { index } => { if let Some(variants) = layout.ty.variant_range(tcx) { - assert!(variants.contains(idx)); + assert!(variants.contains(index)); } else { // Types without variants use `0` as dummy variant index. - assert!(idx.as_u32() == 0); + assert!(index.as_u32() == 0); } } Variants::Multiple { variants, tag, tag_encoding, .. } => { |
