Skip to content

Added Debug information to layout error #3194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bindgen/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2339,6 +2339,17 @@ 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.
if layout.is_none() {
let location_option = item.location();
let error = match location_option {
Some(location) => format!(
"Unable to get layout information from: {location}"
),
None => "Unable to get layout information or location"
.to_string(),
};
panic!("{}", error);
}
let layout = layout.expect("Unable to get layout information?");
if struct_layout.requires_explicit_align(layout) {
explicit_align = Some(layout.align);
Expand Down
Loading