about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-10-20 01:45:15 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-10-20 02:12:58 -0700
commit9f4c9155d4535e08a3148e792711447e44541cd1 (patch)
tree96be66909486d08ea657fb7b40ee220a7b39806f /compiler/rustc_ty_utils/src
parent68d1fd942710eb7cb408f3dea2f6e1845f6cbe87 (diff)
downloadrust-9f4c9155d4535e08a3148e792711447e44541cd1.tar.gz
rust-9f4c9155d4535e08a3148e792711447e44541cd1.zip
compiler: Reject impossible reprs during enum layout
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/layout.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index db70a12a4d1..38b292afe8d 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -116,6 +116,11 @@ fn map_error<'tcx>(
             cx.tcx().dcx().delayed_bug(format!("computed layout of empty union: {ty:?}"));
             LayoutError::Unknown(ty)
         }
+        LayoutCalculatorError::ReprConflict => {
+            // packed enums are the only known trigger of this, but others might arise
+            cx.tcx().dcx().delayed_bug(format!("computed impossible repr (packed enum?): {ty:?}"));
+            LayoutError::Unknown(ty)
+        }
     };
     error(cx, err)
 }