-
Notifications
You must be signed in to change notification settings - Fork 699
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
Panic with 'Unable to get layout information?' #1768
Comments
I'm on Linux unfortunately :( The panic is here: rust-bindgen/src/codegen/mod.rs Line 1682 in f568d09
|
(Sorry, pressed enter too early) Would be good to try to get a standalone test-case, there are instructions for that in the CONTRIBUTING file. Alternatively printing some information about the union in there may help figure out which type is the one causing havoc. Thanks for reporting this! |
I was able to reproduce this issue on my mac. The same issue seems to exist for Linux as well. I have produced a build script that is supposed to work on both mac and linux. https://github.com/Neo-Zhixing/openvdb-sys |
The problematic item, when printed, looks like this: Item {
id: ItemId(67559),
local_id: LazyCell { inner: UnsafeCell },
next_child_local_id: Cell { value: 1 },
canonical_name: LazyCell { inner: UnsafeCell },
path_for_whitelisting: LazyCell { inner: UnsafeCell },
comment: None,
annotations: Annotations {
opaque: false,
hide: false,
use_instead_of: None,
disallow_copy: false,
private_fields: None,
accessor_kind: None,
constify_enum_variant: false, derives: [] },
parent_id: ItemId(67548),
kind: Type(Type {
name: Some("ptr_converter"),
layout: None,
kind: Comp(CompInfo {
kind: Union,
fields: AfterComputingBitfieldUnits { fields: [], has_bitfield_units: false },
template_params: [TypeId(ItemId(67560))],
methods: [],
constructors: [],
destructor: None,
base_members: [],
inner_types: [],
inner_vars: [],
has_own_virtual_method: false,
has_destructor: false,
has_nonempty_base: false,
has_non_type_template_params: false,
packed_attr: false,
found_unknown_attr: false,
is_forward_declaration: false,
}),
is_const: false
})
} |
I was able to produce a test case that breaks struct atomic_impl {
template<typename value_t>
union ptr_converter;
}; Errors:
The breaking item came from <tbb/atomic.h> The problem boils down to struct atomic_impl2 {
template<typename value_t>
union ptr_converter;
}; For this one, @virtualritz Since this was brought in from |
Thanks for the reduced test-case, that's awesome! Yeah, that should be considered a forward declaration but it's not, that is very odd. |
Hey. I'm also getting this issue (wrapping another lib that depends on tbb). As a work around if I'm not bothered about that type. Edit: Wait. I missed your work around above. Sorry will try that. |
@emilio Here's an even smaller test case: variant.hpp #include <variant> main.rs
This one truly surprised me, while i was trying to find what caused it... 😅/😢 It causes this panic:
The backtrace doesn't have more than what @Neo-Zhixing posted. |
I have tracked down another case from Intel TBB template<typename value_t>
union ptr_converter; //Primary template declared, but never defined.
template<typename value_t>
union ptr_converter<value_t *> {
ptr_converter(){}
ptr_converter(value_t* a_value) : value(a_value) {}
value_t* value;
uintptr_t bits;
}; Empty union, not forward declaration. |
It would be useful if bindgen emitted error information about which file it failed to process. |
- Addresses rust-lang#1768 - Originated from Danielmelody@854ed49 Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
I'm trying to create a wrapper around OpenVDB C++ library. OpenVDB is a volume data file format used in blockbuster visual effects.
There is a repo with instructions to replicate on macOS. The panic happens pretty late during binding generation.
Bindgen Invocation
Actual Results
The text was updated successfully, but these errors were encountered: