Age | Commit message (Collapse) | Author |
|
remove `clap` dependency :tada:
update the book installation instructions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This addresses the underlying issue identified in #1671, that size_t
(integer that can hold any object size) isn't guaranteed to match usize,
which is defined more like uintptr_t (integer that can hold any
pointer). However, on almost all platforms, this is true, and in fact
Rust already uses usize extensively in contexts where size_t would be
more appropriate, such as slice indexing. So, it's better for ergonomics
when interfacing with C code to map the C size_t type to usize. (See
also discussion in rust-lang/rust#65473 about how usize really should be
defined as size_t, not uintptr_t.)
The previous fix for #1671 removed the special case for size_t and
defaulted to binding it as a normal typedef. This change effectively
reverts that and goes back to mapping size_t to usize (and ssize_t to
isize), but also ensures that if size_t is emitted, the typedef'd type
of size_t in fact is compatible with usize (defined by checking that the
size and alignment match the target pointer width). For (hypothetical)
platforms where this is not true, or for compatibility with the default
behavior of bindgen between 0.53 and this commit, onwards, you can
disable this mapping with --no-size_t-is-usize.
|
|
|
|
This doesn't change behavior but makes the code make more sense.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Clears clippy::items_after_statements warning for tests.
|
|
So that rustc doesn't take too much stack space without optimizations.
Fixes #2218
|
|
cargo clippy --fix --tests
cargo +nightly fmt
|
|
|
|
Closes #2206
|
|
Instead of dereferencing a null pointer, create a MaybeUninit from which
we can extract well-defined addresses.
|
|
It's impossible to #[derive] from any other trait when not deriving from
Copy when using the newest Rust nightly. Any attempt to do that results
in the following error:
error: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
Fixes: #2083
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
|
|
Previously, anonymous enums generated a type alias but did not use it.
For example the following:
```C
enum {
ZERO,
ONE = 4999,
};
```
Generated this:
```Rust
/* automatically generated by rust-bindgen 0.59.2 */
pub const ZERO: ::std::os::raw::c_uint = 0;
pub const ONE: ::std::os::raw::c_uint = 4999;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
```
For use cases where humans look at bindgen's Rust output this was a little
strange since it's a deviation from how the Rust output for named enums
is organized, where all constants share the same type using the type
alias. The unused type alias also triggered the dead_code lint.
Change to use the generated type alias.
|
|
|
|
this includes comments and must_use annotations
|
|
|
|
|
|
* 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.
|
|
Closes #2163
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fixes #2143
|
|
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.
|
|
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.
|
|
|
|
derives, or prevent deriving traits
Fixes #2076
|