Skip to content

Conversation

@cpu
Copy link
Member

@cpu cpu commented Sep 28, 2025

We have a small collection of macro_rules! macros that define types: one helper making a u32 rustls_result enum, and a handful for defining opaque structs implementing Castable.

These are handy, but they require we use cbindgen's parse.expand functionality. This in turn requires the nightly toolchain to allow cbindgen to expand the macro definitions before generating the .h file. This worked OK for a while, but nightly broke the handling of cfg feature guards way back in April, requiring that contributors + CI both pin to nightly-2025-03-25.

Since the bug I opened upstream (rust-lang/rust#139715) hasn't received any significant attention in months let's stop using macros in this context so we can go back to cbindgen without parse.expand and the stable toolchain. We can't stay pinned to nightly-2025-03-25 forever.

cpu added 4 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.
@cpu cpu self-assigned this Sep 28, 2025
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.

LGTM!

@cpu cpu marked this pull request as draft October 21, 2025 21:10
@cpu
Copy link
Member Author

cpu commented Oct 27, 2025

Closing in favour of #618

@cpu cpu closed this Oct 27, 2025
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