-
Notifications
You must be signed in to change notification settings - Fork 373
defines is not applied for impl const #955
Copy link
Copy link
Description
source (x.rs):
#[repr(C)]
pub struct Foo {
a: i32,
#[cfg(feature = "feat")]
b: i32,
}
impl Foo {
pub const ZEROED: Self = Self {
a: 0,
#[cfg(feature = "feat")]
b: 0,
};
}cbindgen.toml:
[export]
include=["Foo"]
[defines]
"feature = feat" = "FEAT"command:
cbindgen --config cbindgen.toml x.rsactual result:
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
struct Foo {
int32_t a;
#if defined(FEAT)
int32_t b
#endif
;
};
constexpr static const Foo Foo_ZEROED = Foo{ /* .a = */ 0, /* .b = */ 0 };expected result:
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
struct Foo {
int32_t a;
#if defined(FEAT)
int32_t b
#endif
;
};
constexpr static const Foo Foo_ZEROED = Foo{
/* .a = */ 0,
#if defined(FEAT)
/* .b = */ 0
#endif
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels