* Updated tests/expectations/Cargo.toml to use 2018 rust.
* Added Debug and Copy to objective-c structs.
* Fixed lifetimes in objective-c trait templates.
* Fixed imports for objective-c expectations tests.
Adding a custom derive like "serde::Deserialize" results in a panic complaining
that it is not a valid Ident. Derive params are not identifiers, so treat it as
a token stream instead.
* cexpr+env_logger bump.
* Various fixes for C++ crashes / hangs.
* Enums now respect annotations and derives properly in more cases.
* Some more APIs (blocklist-file, etc).
* 'static lifetime is elided when appropriate.
Update Item to hold a `clang::SourceLocation` and use this to allow
blocklisting based on filename.
The existing code has a special case that always maps <stdint.h> integer
types to corresponding Rust integer types, even if the C types are
blocklisted. To match this special case behaviour, also treat these
C <stdint.h> types as being eligible for derived Copy/Clone/Debug
traits.
Fixes#2096
Constant and static declaration have a 'static live time by default,
that is already elided since 1.17.
Clippy complains on this kind of strings that are present in the
generated code.
This patch remove the 'static live time for those strings when rustc >
1.17 via a new added RustFeature.
Fix#1612
Signed-off-by: Alberto Planas <aplanas@suse.com>
Custom derives are just as useful on enums as they are on structs; not
supporting this was an oversight.
Adds a test that will fail to compile if the custom derive doesn't work
on enums. This test fails without the codegen fix.
This previously produced a type alias which referred to itself,
which was clearly wrong and resulted in downstream code recursing
infinitely.
The problem case (per bug #2102) is:
template <typename> class B{};
template <typename c> class C {
public:
using U = B<c>;
};
class A : C<A> {
U u;
};
As far as I can tell, we parse clang's definition of B<A>; that leads
us to parse A; to find it has a field U which turns out to be of type
B<A>. And so we hit the line in item.rs which says:
debug!("Avoiding recursion parsing type: {:?}", ty);
and bail out, returning the original item ID: hence, a self-
referential typedef is created.
The 'fix' in this PR creates an opaque type in this case instead,
to avoid later infinite loops. It would be preferable to avoid this
situation in the first place, but presumably that would require
us to split the parsing phase into two:
1) types
2) fields within those types.
Fixes#2102.
The --explicit-padding flag would make bindgen try to add tail padding
to rust unions, by adding up the size of all the union fields and
subtracting from the size of the union as given by clang. The total size
of a union's fields is always larger than the union, so the subtraction
underflowed and bindgen produced padding fields larger than addressable
RAM.