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

Merge generic enum tags #785

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Benjamin-Davies
Copy link

See attached issue.

Resolves #784

@morrisonlevi
Copy link

Looks good to me as a total outsider. @emilio, are you the right person to ping these days? You have the most commits last year.

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.

Sorry for the lag here, I haven't been able to take a look lately at cbindgen stuff.

In general the feature makes sense, but instead of the Rc<Cell<>> shenanigans and having to keep the unmangled paths around, it seems it could be implemented more cleanly and efficiently in instantiate_monomorph. At that point, you know you have a generic, and you're going to monomorphize it. It should be feasible to synthesize a tag enum there, and just carry an is_monomorphic: bool or so to avoid generating the tag if needed.

src/bindgen/ir/enumeration.rs Outdated Show resolved Hide resolved
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! Looks much better. Some final requests, and also can you add the new option to the docs?

With that it looks good.

src/bindgen/ir/enumeration.rs Outdated Show resolved Hide resolved
src/bindgen/ir/enumeration.rs Outdated Show resolved Hide resolved
tests/tests.rs Outdated Show resolved Hide resolved
src/bindgen/ir/enumeration.rs Outdated Show resolved Hide resolved
@emilio
Copy link
Collaborator

emilio commented Jun 1, 2023

Thanks, if CI is green this looks good. Can you squash your commits in the way you best see fit so that we don't have "Tidy up" commits? Or would you be fine with me squashing before merging?

@mxyns
Copy link

mxyns commented Dec 23, 2023

hi all, i am interested in getting this PR merged as it would greatly help me in my project 🙂 Is there something I can do to make this happen?
@emilio are you still the person to ping or should is there someone else you can refer us to?

mxyns added a commit to network-analytics/pmacct-gauze that referenced this pull request Dec 24, 2023
generated code is ugly until we get mozilla/cbindgen#785 merged.
when this is done, type aliases can be used and it will look okay
mxyns added a commit to network-analytics/pmacct-gauze that referenced this pull request Feb 27, 2024
@mxyns
Copy link

mxyns commented Jun 13, 2024

hi @emilio
Do you think this could be merged soon?
It looks like @Benjamin-Davies has addressed your last comment about tidying up commits.

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.

Merge generic tag enums
4 participants