Skip to content

Conversation

@ctz
Copy link
Member

@ctz ctz commented Oct 27, 2025

This works because cbindgen does not need to expand derive macros to see the enum items, and cbindgen does not care about the existence of impl From<u32> for the rust type that the derive outputs.

On top of #610

cpu and others added 5 commits September 28, 2025 13:44
We only used this for `rustls_result`, and in practice it only saved us
having to implement `From<u32>` by hand. That's handy, but comes at the
cost of needing to use the nightly toolchain w/ cbindgen so it can
expand the macro before generating the `.h`. That wasn't the worst, but
a nighty regression that has remained unfixed for months broke this
workflow.

In sum: life will be easier without the macro. RIP.
They're helpful, but require us to use cbindgen's parse.expand feature
which in turn requires nightly, and is broken with nightly since ~April.
Since we have no macros anymore, it's not needed.
This works because cbindgen does not need to expand derive macros
to see the enum items, and cbindgen does not care about the existence
of `impl From<u32>` for the rust type that the derive outputs.
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

I don't love it, but I certainly won't object to it.

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Seems like a good compromise 👍 Thanks!

@cpu cpu merged commit 0b5f053 into main Oct 27, 2025
57 checks passed
@cpu cpu deleted the jbp-enum-macro branch October 27, 2025 15:20
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.

3 participants