Jason Orendorff
c732069b2e
New type GenericParam represents a generic parameter.
2022-05-09 16:13:39 +02:00
Emilio Cobos Álvarez
305ccfe746
constant: Make const.allow_constexpr default to true.
2022-04-21 18:48:00 +02:00
Emilio Cobos Álvarez
15e1131160
constant: Allow more constexpr constants.
2022-04-21 18:48:00 +02:00
kavoor
5b418d968c
Support rename rule for union body members.
...
Closes #751 .
2022-04-19 11:22:04 +02:00
Emilio Cobos Álvarez
770f352375
constant: Add support for other expressions WebRender uses.
2022-04-14 23:41:07 +02:00
Emilio Cobos Álvarez
882af0b563
constant: Add support for associated constant expressions.
...
These are useful for bitflags.
2022-04-14 23:41:07 +02:00
Jordan Rose
20ddfffb6a
Fix regression in CamelCase rename rule (should be lowerCamelCase)
2022-04-05 22:54:52 +02:00
Emilio Cobos Álvarez
09284108eb
enumeration: simplify standard types in variants.
...
Fixes #745
2022-04-04 20:25:01 +02:00
Vadim Petrochenkov
ca7a942ce5
Cython: Omit per-variant tags in unions generated for Rust enums
...
The common `tag` should already be enough, al other tags are identical to it.
In Cython case they only create noise because the declarations only introduce names and do not determine layouts.
2022-03-31 21:57:16 +02:00
Olivier Goffart
ed8d94619f
unraw the identifiers
...
Fixes https://github.com/eqrion/cbindgen/issues/410
2021-12-14 16:18:41 +01:00
Emilio Cobos Álvarez
a1694cd57c
ir: Honor documentation_length in Cython.
2021-11-02 11:31:30 +01:00
Sean McArthur
0e3f9bd9cb
Add documentation_style to with short and full options
2021-11-02 11:13:49 +01:00
Emilio Cobos Álvarez
577b041933
tests: Add a test for #708
2021-08-24 11:44:51 +02:00
Emilio Cobos Álvarez
57add9c860
Fix some clippy lints.
2021-06-21 13:25:53 +02:00
Kendall Koning
63c1043dfb
Simplify Pin<T> to T
...
cbindgen already simplifies `MaybeUninit<T>` and `ManuallyDrop<T>` to `T`. This adds `Pin<T>` as well.
2021-06-19 20:48:57 +02:00
Kendall Koning
4e394493d6
Ignore PhantomPinned
...
cbindgen already ignores `PhantomData`. It should ignore
`PhantomPinned` for the same reasons.
Closes #695
Fixes #694
2021-06-19 10:35:08 +02:00
Emilio Cobos Álvarez
a9af0ad5ad
ir: Tweak monomorphization to instantiate recursively after inserting to the replacements map.
...
That way the check to prevent double-instantiation also works to prevent
infinite recursion.
2021-04-07 13:26:35 +02:00
Emilio Cobos Álvarez
52de917d25
parser: Fix handling of #[path] attributes inside inline submodules.
...
As seen in hashbrown:
#[cfg(feature = "raw")]
/// Experimental and unsafe `RawTable` API. This module is only available if the
/// `raw` feature is enabled.
pub mod raw {
// The RawTable API is still experimental and is not properly documented yet.
#[allow(missing_docs)]
#[path = "mod.rs"]
mod inner;
pub use inner::*;
#[cfg(feature = "rayon")]
pub mod rayon {
pub use crate::external_trait_impls::rayon::raw::*;
}
}
2021-04-07 13:25:57 +02:00
Marc-André Lureau
ccea33ecb4
tests: check renaming enum affects variant prefix
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-03-29 14:08:02 +02:00
Emilio Cobos Álvarez
aaef260faf
ir: Simplify types in generics.
...
This was an oversight in 1903686f9eb09f587885d579f3e14c990e799938
because the code I grabbed to visit the generics was dealing with them
somewhere else.
2021-03-02 20:11:39 +01:00
Emilio Cobos Álvarez
7312b997be
ir: simplify_standard_types should be recursive.
...
Stuff like *mut Option<&mut Foo> should really be *mut *mut Foo for
example.
2021-02-24 18:36:40 +01:00
Emilio Cobos Álvarez
c5c301b08a
ir: Support pointers to zsts.
...
Fixes #654
2021-02-01 13:56:45 +01:00
Emilio Cobos Álvarez
750745831a
ir: Deal with name conflicts correctly in declaration type resolution.
...
So, basically, make opaque items last, and make previous names override
them.
Fixes #649
2021-01-26 12:55:05 +01:00
Emilio Cobos Álvarez
c47ee1516b
ir: Handle NonZero and simplify Option<NonZero> like we simplify Option<NonNull>.
...
Fixes #646
2021-01-14 23:39:59 +01:00
Emilio Cobos Álvarez
f922f68531
ir: Avoid generating bogus pointer arguments.
...
Now that we track nullability in the pointer type it's easy to do it.
Fixes #223
2021-01-14 23:39:59 +01:00
Vadim Petrochenkov
b82e375254
enum: Support inlined definitions for tuple variants with a single field
2020-12-09 19:38:21 +01:00
Yurii Rashkovskii
1963f0c92e
Partially support #[cfg]
s on fields
2020-12-06 13:10:15 +01:00
Vadim Petrochenkov
dfcee869ba
enum: Do not forget to rename entities in enum discriminants
2020-12-06 01:53:09 +01:00
Emilio Cobos Álvarez
fbc2237b7d
parser: Fix resolution of #[path] dependencies from certain modules.
...
We need the current mod dir to resolve #[path], not the one we get for
rust 2018.
Fixes #599
2020-11-30 19:44:45 +01:00
Vadim Petrochenkov
8997277cb7
enum: Break up Enum::write
into multiple functions
2020-11-30 11:59:02 +01:00
Vadim Petrochenkov
7980288a94
Reenable some tests
2020-11-27 01:31:01 +01:00
Vadim Petrochenkov
98b7a3f9b9
cython: Leave out values of constants and enumerators
...
Keep them as documentation only
2020-11-27 01:31:01 +01:00
Jordan Rose
198157b53f
tests: Provide a fallback for CARGO_BIN_EXE_ for earlier Rusts
2020-11-26 11:04:20 +01:00
Wodann
68a1e65875
fix: default style to Both (as specified in docs)
...
Closes #615 .
Closes #215 .
Possibly closes others.
2020-11-25 18:04:30 +01:00
Wodann
5b5b46b7d6
fix: resolve path types for 'both' style
2020-11-25 17:55:58 +01:00
Emilio Cobos Álvarez
85a2f4c956
tests: Remove unneeded test file.
2020-11-25 17:50:38 +01:00
Vadim Petrochenkov
b0aae44c77
Add two Cython-specific options to the config
2020-11-25 17:33:38 +01:00
Vadim Petrochenkov
1c1d4754ce
tests: Remove Cython-specific configs
2020-11-25 17:30:30 +01:00
Vadim Petrochenkov
51405d1277
Support generation of Cython bindings
2020-11-17 15:27:34 +01:00
Vadim Petrochenkov
a689bcabc7
Support an annotation for generating bitfield sizes in C code (: SIZE
)
...
Closes #609
Closes #611
2020-10-31 17:05:49 +01:00
Vadim Petrochenkov
a93034c229
test suite: Normalize dashes to underscores in test names
2020-10-31 17:01:44 +01:00
Vadim Petrochenkov
b69a9cfe80
Support wider range of expressions in enum discriminants
2020-10-31 16:58:37 +01:00
Jordan Rose
0ba241498e
Allow controlling the Cargo profile used for macro expansion
...
If there's already a release build, it's better for cbindgen to reuse
the build artifacts from that to expand macros rather than starting
from scratch with a debug build. Controlled with
--profile (debug|release)
as well as parse.expand.profile in cbindgen.toml, though hardcoding a
profile in a config file seems unlikely.
2020-10-27 11:35:10 +01:00
Vadim Petrochenkov
398b28ca30
Add an option for converting usize/isize into size_t/ptrdiff_t
2020-10-27 11:34:27 +01:00
Vadim Petrochenkov
050863a249
test suite: Remove existing duplicate expectation files
2020-10-20 22:59:14 +02:00
Vadim Petrochenkov
3a7e24d2d7
test suite: Do not generate identical expectation files
2020-10-20 22:59:14 +02:00
Vadim Petrochenkov
9f00f6fdc5
Remove artificial restriction on lifetime parameters on enums
2020-10-20 22:57:43 +02:00
Vadim Petrochenkov
d09fe6b753
test suite: Use suffixes instead of directories for test variants
2020-10-19 20:33:29 +02:00
Vadim Petrochenkov
aeb69bcc69
Switch default sorting order for items to "None"
2020-10-05 19:57:33 +02:00
Vadim Petrochenkov
f3d5a20363
Support sort_by
for constants
...
Also support a global default for `sort_by` affecting both functions and constants.
2020-10-05 19:57:33 +02:00