diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index c84320ce5b..2161f65b8b 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -2143,7 +2143,7 @@ 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); }