From 98e11b8aeddf5b259a8c839c346fd26c03efc50d Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 1 Aug 2022 12:07:31 -0400 Subject: [PATCH] fix for unions with scalar layout --- compiler/rustc_middle/src/ty/layout_sanity_check.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_middle/src/ty/layout_sanity_check.rs b/compiler/rustc_middle/src/ty/layout_sanity_check.rs index 95bc81517da0..38dc65338371 100644 --- a/compiler/rustc_middle/src/ty/layout_sanity_check.rs +++ b/compiler/rustc_middle/src/ty/layout_sanity_check.rs @@ -91,6 +91,10 @@ pub(super) fn sanity_check_layout<'tcx>( FieldsShape::Primitive => { // Fine. } + FieldsShape::Union(..) => { + // FIXME: I guess we could also check something here? Like, look at all fields? + return; + } FieldsShape::Arbitrary { .. } => { // Should be an enum, the only field is the discriminant. assert!(