about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorouz-a <oguz.agcayazi@gmail.com>2022-01-15 15:03:38 +0300
committerouz-a <oguz.agcayazi@gmail.com>2022-02-01 13:01:19 +0300
commitfd5be23a96274cb1d1f83acdd8f7370ee15e00fa (patch)
treecfe8626a398fd2184d884ad1e1b800535da0627c /compiler/rustc_middle
parent38c22af0153cf8f920c01ef04493e8878401fd18 (diff)
fix for the issue #92464
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/layout.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 4e6b2acb67f..f98261e5e5e 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -1310,7 +1310,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
                     },
                 };
                 let mut abi = Abi::Aggregate { sized: true };
-                if tag.value.size(dl) == size {
+
+                // Without latter check aligned enums with custom discriminant values
+                // Would result in ICE see the issue #92464 for more info
+                if tag.value.size(dl) == size || variants.iter().all(|layout| layout.is_empty()) {
                     abi = Abi::Scalar(tag);
                 } else {
                     // Try to use a ScalarPair for all tagged enums.