Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a non-C-like-enumeration size mismatch between Rust and C when using Style::Tag. #463

Conversation

sw17ch
Copy link
Contributor

@sw17ch sw17ch commented Jan 25, 2020

When using Style::Tag with non-C-like-enumerations and discriminant types that do not match the size of enumerations in C (such as those with #[repr(C, u8)]), cbindgen emits types that are incompatible between Rust and C.

I have found two problems:

Inconsistent Padding

Here's the input type:

#[repr(C, u8)]
enum Tu64 {
    None,
    Some(u64),
}

Here's the generated C code:

enum Tu64_Tag {
  None,
  Some,
};
typedef uint8_t Tu64_Tag;

struct Some_Body {
  uint64_t _0;
};

struct Tu64 {
  enum Tu64_Tag tag;
  union {
    struct Some_Body some;
  };
};

In this case, both C and Rust agree that Tu64 is sized as 16 bytes. The u64 forces its alignment to 8 bytes, so Rust designates the first byte as the discriminant, and the following 7 bytes as padding.

However, C has the tag defined as an enum Tu64_Tag. This means that the tag is sized the same way enumerations are on the host system. In our case, that's likely going to be 4 bytes. In C, the first 4 bytes are discriminant, and the following 4 are padding.

This means the interface between Rust and C is unsafe since the discriminant C reads may be influenced by noise in padding bytes that Rust may not initialize. For example, allocating a Tu64 in C, setting it all to 0xFF, then passing it by reference into Rust for initialization will result in a corrupted discriminant when C looks at the initialization result.

Inconsistent Sizes

We'll use an example similar to the one above, but replace the u64 with a u8.

#[repr(C, u8)]
enum Tu8 {
    None,
    Some(u8),
}

Here's the generated code:

enum Tu8_Tag {
  None,
  Some,
};
typedef uint8_t Tu8_Tag;

struct Some_Body {
  uint8_t _0;
};

struct Tu8 {
  enum Tu8_Tag tag;
  union {
    struct Some_Body some;
  };
};

In this case, Rust sees that the value we can hold in the enum and the discriminant are both of size 1, so we can safely pack them in 2 bytes.

However, in C, we can see that we're still using enum Tu8_Tag for the discriminant tag type. This means that the size in C is going to be at least the size of an enumeration + 1 byte, and will have an alignment other than the one used by Rust.

Passing a Tu8 from C to Rust results in Rust reading a corrupted body value. Passing a Tu8 from Rust to C will almost certainly result in corruption of the tag. Furthermore, any mutation C does to the Tu8 allocated by Rust can corrupt unrelated structures in Rust's memory by overflowing the bounds of Rust's Tu8.

Solution

In both cases, the solution is to use the typedef that's generated as the tag type in C. That is, using Tu64_Tag tag instead of enum Tu64_Tag tag and Tu8_Tag tag instead of enum Tu8_Tag tag.

Testing

This PR includes some extra infrastructure so that tests to verify this sort of thing can be written. The details of this test system are documented in the commit message of ea03db1. The test I added is at tests/checkers/tag/enum.c. The body of this test #includes the cbindgen generated file, and then verifies the expected size. If bac063e is checked out, this test is seen to fail in cargo test.

Fix

I have created another commit that appears to fix this issue (by not emitting the enum before the tag type name when the representation expresses a size), and does not cause any other tests to fail. I'm not convinced this is the best way to fix this, nor is the importance of the change in df0167b obvious. I would appreciate feedback about alternative ways to fix this that might be more clear to future readers.

@sw17ch sw17ch force-pushed the jvanenk/fix-tagged-non-C-like-enumeration-descriminant branch from c7957da to 9d2b8fa Compare January 25, 2020 08:26
Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! So, the fix looks good, but I have one suggestion / simplification that doesn't require adding all the "checkers" infrastructure. Given so far we only have use cases for static_asserts, is there any reason your patch can't be replaced by something like creating tests/rust/enum.toml, with something like:

trailer = """
  static_assert(sizeof(struct P) == 4, "unexpected size for P");
"""

In general it'd be good to have better end-to-end tests, but that requires at least linking the rust code too.

Probably if we do that, we should spend some effort to automatically verify the struct offsets and sizes and what not. But that requires either generating some rust code with assertions and such, which requires a bit more thought and probably a bit more work, or parsing -Z print-type-sizes, which doesn't sound terribly appealing.

So lacking that, it doesn't seem to me that the checker infrastructure brings much benefit over just (ab)-using the trailer option. Thoughts?


#include <assert.h>

static_assert(sizeof(struct P) == 4, "unexpected size for P");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is static_assert a C thing nowadays? since when?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Oh, I found this btw, TIL that C11 won static_assert, that's great)

emilio added a commit to emilio/cbindgen that referenced this pull request Jan 26, 2020
This will be useful to add static assertion to some tests like mozilla#463 wants to do.

For example, in the case of the test for mozilla#463, the test would need something
like:

    trailer = """
    #include <assert.h>

    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    static_assert(sizeof(struct P) == 4, "unexpected size for P");
    #else
    static_assert(sizeof(P) == 4, "unexpected size for P");
    #endif
    """

As more of these tests are added it may be worth just adding a helper header
like this to avoid some duplication:

    #include <assert.h>
    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    #define CBINDGEN_STRUCT(name) struct name
    #else
    #define CBINDGEN_STRUCT(name) name
    #endif

And so on, so the previous configuration would become just:

    trailer = """
    #include "testing-helpers.h" // Or whatever
    static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
    """

That may or may not be overkill to do as part of mozilla#463.
@emilio
Copy link
Collaborator

emilio commented Jan 26, 2020

I opened #465 with a proposal with a slightly less invasive change which allows to test this as well, and has the side benefit of testing it on all the styles / configurations. WDYT?

@sw17ch
Copy link
Contributor Author

sw17ch commented Jan 26, 2020

This sounds great. I'm happy to add the trailers (I didn't realize trailers were a supported feature). If you merge #465 with the helper, I'll replace my test infrastructure in this test with trailers in the toml file.

Thank you!

emilio added a commit that referenced this pull request Jan 26, 2020
This will be useful to add static assertion to some tests like #463 wants to do.

For example, in the case of the test for #463, the test would need something
like:

    trailer = """
    #include <assert.h>

    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    static_assert(sizeof(struct P) == 4, "unexpected size for P");
    #else
    static_assert(sizeof(P) == 4, "unexpected size for P");
    #endif
    """

As more of these tests are added it may be worth just adding a helper header
like this to avoid some duplication:

    #include <assert.h>
    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    #define CBINDGEN_STRUCT(name) struct name
    #else
    #define CBINDGEN_STRUCT(name) name
    #endif

And so on, so the previous configuration would become just:

    trailer = """
    #include "testing-helpers.h" // Or whatever
    static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
    """

That may or may not be overkill to do as part of #463.
@emilio
Copy link
Collaborator

emilio commented Jan 26, 2020

Alright, merged that to master, as it was green. Thanks for bearing with me!

@sw17ch sw17ch force-pushed the jvanenk/fix-tagged-non-C-like-enumeration-descriminant branch from 9d2b8fa to 7a67d71 Compare January 26, 2020 02:36
This affected cases where the style was set to `Stle::Tag`.

In enumerations, do not emut the tag type name with an `enum`
prefix. C treats the `enum` type as an `int` even if the
representation should be something else.

Here's an example non-C-like-enumeration:

    #[repr(C, u8)]
    enum P {
        P1(u8),
        P2(u8, u8),
        P3(u8, u8, u8),
    }

Without this patch, this is what's generated:

    enum P_Tag {
      P1,
      P2,
      P3,
    };
    typedef uint8_t P_Tag;

    typedef struct {
      uint8_t _0;
    } P1_Body;

    typedef struct {
      uint8_t _0;
      uint8_t _1;
    } P2_Body;

    typedef struct {
      uint8_t _0;
      uint8_t _1;
      uint8_t _2;
    } P3_Body;

    typedef struct {
      enum P_Tag tag;
      union {
        P1_Body p1;
        P2_Body p2;
        P3_Body p3;
      };
    } P;

Rust expects the size of the type to be 4 (one for the discriminant,
and 3 for the widest alternative. C, however, treats the `enum P_Tag
tag` field as an `int` rather than a `uint8_t`. This puts the size
(with padding) of of `P` to 8 bytes instead of 4. When passing this
type between Rust and C, they will disagree on the size.

After the patch is applied, the `P` struct is properly defined:

    typedef struct {
      P_Tag tag;
      union {
        P1_Body p1;
        P2_Body p2;
        P3_Body p3;
      };
    } P;
@sw17ch sw17ch force-pushed the jvanenk/fix-tagged-non-C-like-enumeration-descriminant branch from 7a67d71 to 228f7df Compare January 26, 2020 02:37
@sw17ch
Copy link
Contributor Author

sw17ch commented Jan 26, 2020

Force-pushed from 9d2b8fa to 228f7df. This drops the checkers tests in favor of static assertions in the trailers. I also added some uses of offsetof to demonstrate where the tags and bodies are expected. I've only done this for the single struct.

Using trailers was a much better idea. Thank you for the assistance!

Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks great!

@emilio emilio merged commit 4cb762e into mozilla:master Jan 26, 2020
emilio added a commit that referenced this pull request Jan 31, 2020
 * Support 'swift_name' attributes on generated functions (#449)
 * Add [export.pre_body] to config (#452)
 * Handle new line in doc attribute (#454)
 * Add support for `Self` in tagged enums, structs and unions (#455, #455, #456)
 * Make sentinel variant respect regular config (#459)
 * Fix layout of tagged enums with size under some configurations (#463)
 * Add an option to allow configuring the order of function names in generated headers (#466)

Thanks to all the awesome contributors.
emilio added a commit that referenced this pull request Jan 31, 2020
 * Support 'swift_name' attributes on generated functions (#449)
 * Add [export.pre_body] to config (#452)
 * Handle new line in doc attribute (#454)
 * Add support for `Self` in tagged enums, structs and unions (#455, #455, #456)
 * Make sentinel variant respect regular config (#459)
 * Fix layout of tagged enums with size under some configurations (#463)
 * Add an option to allow configuring the order of function names in generated headers (#466)

Thanks to all the awesome contributors.
bors bot added a commit to jjs-dev/jjs that referenced this pull request Feb 1, 2020
232: Bump cbindgen from 0.12.2 to 0.13.0 r=MikailBag a=dependabot-preview[bot]

Bumps [cbindgen](https://github.com/eqrion/cbindgen) from 0.12.2 to 0.13.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/eqrion/cbindgen/blob/master/CHANGES">cbindgen's changelog</a>.</em></p>
<blockquote>
<h2>0.13.0</h2>
<pre><code> * Support 'swift_name' attributes on generated functions ([#449](mozilla/cbindgen#449))
 * Add [export.pre_body] to config ([#452](mozilla/cbindgen#452))
 * Handle new line in doc attribute ([#454](mozilla/cbindgen#454))
 * Add support for `Self` in tagged enums, structs and unions ([#455](mozilla/cbindgen#455), [#455](mozilla/cbindgen#455), [#456](mozilla/cbindgen#456))
 * Make sentinel variant respect regular config ([#459](mozilla/cbindgen#459))
 * Fix layout of tagged enums with size under some configurations ([#463](mozilla/cbindgen#463))
 * Add an option to allow configuring the order of function names in generated headers ([#466](mozilla/cbindgen#466))
</code></pre>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/eqrion/cbindgen/commit/5e667158a144e59c221327d12cfc9f7f1c0e744b"><code>5e66715</code></a> Release v0.13.0</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/723e690027209c8e613c729def6a9367e197b00f"><code>723e690</code></a> Add test cases for 'sort_by' option</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/f5edc2c2abf474df886975b8d83a7c46332ce352"><code>f5edc2c</code></a> Document usage of 'sort_by' option</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/2fb3e1d9c4ef83a3014c28f21771546a2485699b"><code>2fb3e1d</code></a> Add option to specify ordering of generated C function prototypes</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/4cb762ec8f24f8ef3e12fcd716326a1207a88018"><code>4cb762e</code></a> Do not emit <code>enum TagName tag</code> when a sized representation is present.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/80487484196026d2efd11131d58859e2da8beee4"><code>8048748</code></a> Add a test that demonstrates Style::Tag can emit structures with incorrect si...</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/12248c2fef57d596dfa9245bd5fec2eabe050002"><code>12248c2</code></a> tests: Add a simple testing-helpers headers that tests can include.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/bd831ded1945ebb28cac8560a570c5522c05b945"><code>bd831de</code></a> tests: Provide style definition to the C / C++ tests.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/ec18611e583ceda551d6e0a926eac95a69b78e44"><code>ec18611</code></a> bindings: Don't add stray newline in trailer.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/e0d4bc17a54fb38857d89bdc10d24bb9242131aa"><code>e0d4bc1</code></a> Make sentinel variant respect regular config</li>
<li>Additional commits viewable in <a href="https://github.com/eqrion/cbindgen/compare/v0.12.2...v0.13.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=cbindgen&package-manager=cargo&previous-version=0.12.2&new-version=0.13.0)](https://dependabot.com/compatibility-score.html?dependency-name=cbindgen&package-manager=cargo&previous-version=0.12.2&new-version=0.13.0)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
bors-servo added a commit to servo/servo that referenced this pull request Apr 24, 2020
Bump cbindgen from 0.9.1 to 0.14.1

Bumps [cbindgen](https://github.com/eqrion/cbindgen) from 0.9.1 to 0.14.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/eqrion/cbindgen/blob/master/CHANGES">cbindgen's changelog</a>.</em></p>
<blockquote>
<h2>0.14.1</h2>
<pre><code> * Handle mangling pointers. ([#508](mozilla/cbindgen#508))
 * Unconditionally generate a return statement in partialeq implementations. ([#509](mozilla/cbindgen#509))
</code></pre>
<h2>0.14.0</h2>
<pre><code> * Minor tweak at how [export.exclude] is handled to allow excluding
   generic instantiations in C mode. ([#501](mozilla/cbindgen#501))
 * Documented cpp_compat option. ([#496](mozilla/cbindgen#496))
 * Fixed a panic when parsing associated constants for a built-in type. ([#494](mozilla/cbindgen#494))
</code></pre>
<h2>0.13.2</h2>
<pre><code> * Constants now have suitable documentation. ([#471](mozilla/cbindgen#471))
 * Fixed some C warnings by emitting void when there are no arguments. ([#470](mozilla/cbindgen#470))
 * Avoids reading cargo.toml when not needed, which can cause panics in workspace situations.
 * Only write `default` cases if the switch is not exhaustive. ([#475](mozilla/cbindgen#475))
 * Some warnings have been refined. ([#477](mozilla/cbindgen#477))
 * Code generation for static arrays has been fixed. ([#479](mozilla/cbindgen#479))
 * Opt-in support for constexpr in constants. ([#481](mozilla/cbindgen#481))
 * Fix C code generation and some warnings when extremely large constants are used. ([#490](mozilla/cbindgen#490))
 * Proper escaping of enum variants and fields. ([#483](mozilla/cbindgen#483))
 * Added support for RefCell (as an opaque type) and Cell. ([#489](mozilla/cbindgen#489))
</code></pre>
<h2>0.13.1</h2>
<pre><code> * Support `#[cfg]` on individual enum variants. ([#469](mozilla/cbindgen#469))
</code></pre>
<h2>0.13.0</h2>
<pre><code> * Support 'swift_name' attributes on generated functions ([#449](mozilla/cbindgen#449))
 * Add [export.pre_body] to config ([#452](mozilla/cbindgen#452))
 * Handle new line in doc attribute ([#454](mozilla/cbindgen#454))
 * Add support for `Self` in tagged enums, structs and unions ([#455](mozilla/cbindgen#455), [#455](mozilla/cbindgen#455), [#456](mozilla/cbindgen#456))
 * Make sentinel variant respect regular config ([#459](mozilla/cbindgen#459))
 * Fix layout of tagged enums with size under some configurations ([#463](mozilla/cbindgen#463))
 * Add an option to allow configuring the order of function names in generated headers ([#466](mozilla/cbindgen#466))
</code></pre>
<h2>0.12.2</h2>
<pre><code> * Fixed version detection with lockfile v2. mozilla/cbindgen#446
 * Added support for export_name on functions. mozilla/cbindgen#447
</code></pre>
<h2>0.12.1</h2>
<pre><code> * Added support for #[repr*64)] on enums. mozilla/cbindgen#441
 * Added support to generate plain enums instead of enum classes for C++. mozilla/cbindgen#443
 * Fixed dependency resolution with lockfile v2. mozilla/cbindgen#438
</code></pre>
</tr></table> ... (truncated)
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/eqrion/cbindgen/commit/0761b9bbe48d01ded1bbec45bbeea5544b3b1002"><code>0761b9b</code></a> Release 0.14.1</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/33d9ecf11f300bd03f431e9f3417c063e681380c"><code>33d9ecf</code></a> Handle mangling pointers.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/0fed9eebc47abcd31e0e69357cd39262c8a5a6cc"><code>0fed9ee</code></a> enum: Unconditionally generate a return statement in partialeq implementations.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/a519f1bda444a0c6c01464296a052d9a05e1d9c4"><code>a519f1b</code></a> Actually use the temp dir for temporary compiled objects.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/4a38a48937264d6ec162b2fd47ffd0e7a091ca72"><code>4a38a48</code></a> Release 0.14.0</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/39bae60ad7ac4711d8fccc0d098ecef98b37d559"><code>39bae60</code></a> Generate test object files in a temporary directory instead of in-tree</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/ec1631f3e47686e6e0c1b7641bb08b0e39c59250"><code>ec1631f</code></a> Allow excluding monomorph structs in C mode.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/6fd245096dcd5c50c1065b4bd6ce62a09df0b39b"><code>6fd2450</code></a> Add missing cpp_compat documentation.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/c265a7562a5ee815057efcc8b1aca31cd3d5318d"><code>c265a75</code></a> parser: Don't panic when finding associated constants to a primitive.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/17d7aad7d07dce8aa665aedbc75c39953afe1600"><code>17d7aad</code></a> Release v0.13.2</li>
<li>Additional commits viewable in <a href="https://github.com/eqrion/cbindgen/compare/v0.9.1...v0.14.1">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=cbindgen&package-manager=cargo&previous-version=0.9.1&new-version=0.14.1)](https://dependabot.com/compatibility-score/?dependency-name=cbindgen&package-manager=cargo&previous-version=0.9.1&new-version=0.14.1)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
bors-servo added a commit to servo/servo that referenced this pull request Apr 24, 2020
Bump cbindgen from 0.9.1 to 0.14.1

Bumps [cbindgen](https://github.com/eqrion/cbindgen) from 0.9.1 to 0.14.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/eqrion/cbindgen/blob/master/CHANGES">cbindgen's changelog</a>.</em></p>
<blockquote>
<h2>0.14.1</h2>
<pre><code> * Handle mangling pointers. ([#508](mozilla/cbindgen#508))
 * Unconditionally generate a return statement in partialeq implementations. ([#509](mozilla/cbindgen#509))
</code></pre>
<h2>0.14.0</h2>
<pre><code> * Minor tweak at how [export.exclude] is handled to allow excluding
   generic instantiations in C mode. ([#501](mozilla/cbindgen#501))
 * Documented cpp_compat option. ([#496](mozilla/cbindgen#496))
 * Fixed a panic when parsing associated constants for a built-in type. ([#494](mozilla/cbindgen#494))
</code></pre>
<h2>0.13.2</h2>
<pre><code> * Constants now have suitable documentation. ([#471](mozilla/cbindgen#471))
 * Fixed some C warnings by emitting void when there are no arguments. ([#470](mozilla/cbindgen#470))
 * Avoids reading cargo.toml when not needed, which can cause panics in workspace situations.
 * Only write `default` cases if the switch is not exhaustive. ([#475](mozilla/cbindgen#475))
 * Some warnings have been refined. ([#477](mozilla/cbindgen#477))
 * Code generation for static arrays has been fixed. ([#479](mozilla/cbindgen#479))
 * Opt-in support for constexpr in constants. ([#481](mozilla/cbindgen#481))
 * Fix C code generation and some warnings when extremely large constants are used. ([#490](mozilla/cbindgen#490))
 * Proper escaping of enum variants and fields. ([#483](mozilla/cbindgen#483))
 * Added support for RefCell (as an opaque type) and Cell. ([#489](mozilla/cbindgen#489))
</code></pre>
<h2>0.13.1</h2>
<pre><code> * Support `#[cfg]` on individual enum variants. ([#469](mozilla/cbindgen#469))
</code></pre>
<h2>0.13.0</h2>
<pre><code> * Support 'swift_name' attributes on generated functions ([#449](mozilla/cbindgen#449))
 * Add [export.pre_body] to config ([#452](mozilla/cbindgen#452))
 * Handle new line in doc attribute ([#454](mozilla/cbindgen#454))
 * Add support for `Self` in tagged enums, structs and unions ([#455](mozilla/cbindgen#455), [#455](mozilla/cbindgen#455), [#456](mozilla/cbindgen#456))
 * Make sentinel variant respect regular config ([#459](mozilla/cbindgen#459))
 * Fix layout of tagged enums with size under some configurations ([#463](mozilla/cbindgen#463))
 * Add an option to allow configuring the order of function names in generated headers ([#466](mozilla/cbindgen#466))
</code></pre>
<h2>0.12.2</h2>
<pre><code> * Fixed version detection with lockfile v2. mozilla/cbindgen#446
 * Added support for export_name on functions. mozilla/cbindgen#447
</code></pre>
<h2>0.12.1</h2>
<pre><code> * Added support for #[repr*64)] on enums. mozilla/cbindgen#441
 * Added support to generate plain enums instead of enum classes for C++. mozilla/cbindgen#443
 * Fixed dependency resolution with lockfile v2. mozilla/cbindgen#438
</code></pre>
</tr></table> ... (truncated)
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/eqrion/cbindgen/commit/0761b9bbe48d01ded1bbec45bbeea5544b3b1002"><code>0761b9b</code></a> Release 0.14.1</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/33d9ecf11f300bd03f431e9f3417c063e681380c"><code>33d9ecf</code></a> Handle mangling pointers.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/0fed9eebc47abcd31e0e69357cd39262c8a5a6cc"><code>0fed9ee</code></a> enum: Unconditionally generate a return statement in partialeq implementations.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/a519f1bda444a0c6c01464296a052d9a05e1d9c4"><code>a519f1b</code></a> Actually use the temp dir for temporary compiled objects.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/4a38a48937264d6ec162b2fd47ffd0e7a091ca72"><code>4a38a48</code></a> Release 0.14.0</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/39bae60ad7ac4711d8fccc0d098ecef98b37d559"><code>39bae60</code></a> Generate test object files in a temporary directory instead of in-tree</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/ec1631f3e47686e6e0c1b7641bb08b0e39c59250"><code>ec1631f</code></a> Allow excluding monomorph structs in C mode.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/6fd245096dcd5c50c1065b4bd6ce62a09df0b39b"><code>6fd2450</code></a> Add missing cpp_compat documentation.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/c265a7562a5ee815057efcc8b1aca31cd3d5318d"><code>c265a75</code></a> parser: Don't panic when finding associated constants to a primitive.</li>
<li><a href="https://github.com/eqrion/cbindgen/commit/17d7aad7d07dce8aa665aedbc75c39953afe1600"><code>17d7aad</code></a> Release v0.13.2</li>
<li>Additional commits viewable in <a href="https://github.com/eqrion/cbindgen/compare/v0.9.1...v0.14.1">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=cbindgen&package-manager=cargo&previous-version=0.9.1&new-version=0.14.1)](https://dependabot.com/compatibility-score/?dependency-name=cbindgen&package-manager=cargo&previous-version=0.9.1&new-version=0.14.1)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants