cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

fix: `NonNull<()>` doesn't lower to `void *`

Open morrisonlevi opened this issue 4 months ago • 0 comments

Without the fix, you get something stupid like this:

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef NonNull MyId;

void takes_id(MyId id);

void takes_unit_ptr(void *id);

I'm not sure if there's a smarter fix but I've hit this issue several times. It may need to apply to more types. The only one I can think of that might be a candidate is Box but I haven't seen Box<()> in the wild myself so I didn't include it.

morrisonlevi avatar Aug 20 '25 21:08 morrisonlevi