summaryrefslogtreecommitdiff
path: root/bindgen/codegen/helpers.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2022-11-28 06:40:20 -0800
committerGitHub <noreply@github.com>2022-11-28 09:40:20 -0500
commit0a78cde484fd5b6a5bbfd4301b3c4cf043a60a38 (patch)
treeec24cc604a33a0443999b77335fc29e70a722f2b /bindgen/codegen/helpers.rs
parent95fd17b874910184cc0fcd33b287fa4e205d9d7a (diff)
Fix name collision between C enum and typedef (#2326)
Fixes #2008. Example: ```c enum Enum { Variant }; typedef int16_t Enum; ``` This is valid and idiomatic C (though not valid C++). `cbindgen` uses this idiom as the default C translation of Rust enums, the equivalent of what would be `enum Enum : int16_t { Variant };` in C++. `bindgen header.h` before: ```rust pub const Enum_Variant: Enum = 0; pub type Enum = ::std::os::raw::c_uint; pub type Enum = i16; ``` ```console error[E0428]: the name `Enum` is defined multiple times --> generated.rs:3:1 | 2 | pub type Enum = ::std::os::raw::c_uint; | --------------------------------------- previous definition of the type `Enum` here 3 | pub type Enum = i16; | ^^^^^^^^^^^^^^^^^^^^ `Enum` redefined here | = note: `Enum` must be defined only once in the type namespace of this module ``` After: ```rust pub const Enum_Variant: Enum = 0; pub type Enum = i16; ```
Diffstat (limited to 'bindgen/codegen/helpers.rs')
0 files changed, 0 insertions, 0 deletions