From c0b24700efa13f4b3597740607a3003da6064a0f Mon Sep 17 00:00:00 2001 From: Moritz Hedtke Date: Thu, 25 Jul 2024 18:28:29 +0200 Subject: [PATCH] Log item for which layout retrieval fails --- bindgen/codegen/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index e2aaee9820..2f8dbd392a 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -2216,7 +2216,9 @@ impl CodeGenerator for CompInfo { } else if is_union && !forward_decl { // TODO(emilio): It'd be nice to unify this with the struct path // above somehow. - let layout = layout.expect("Unable to get layout information?"); + let layout = layout.unwrap_or_else(|| { + panic!("Unable to get layout information for item\n{:#?}", item) + }); if struct_layout.requires_explicit_align(layout) { explicit_align = Some(layout.align); }