Skip to content

Add support for bindings to overloaded functions #240

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

Merged
merged 1 commit into from
Nov 12, 2016

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Nov 12, 2016

This commit (re)adds support for generating bindings to overloaded
functions. First, we use the symbol name instead of the canonical name
when checking if we have already generated bindings for a given
function. Second, we add a map from canonical names to number of times
we have generated a function with that canonical name. We increment this
number every time we generate a function. When the number is greater
than zero, we append it to the function name so that overloaded
functions get a unique Rust symbol.

Fixes #239

r? @emilio

This commit (re)adds support for generating bindings to overloaded
functions. First, we use the symbol name instead of the canonical name
when checking if we have already generated bindings for a given
function. Second, we add a map from canonical names to number of times
we have generated a function with that canonical name. We increment this
number every time we generate a function. When the number is greater
than zero, we append it to the function name so that overloaded
functions get a unique Rust symbol.
@emilio
Copy link
Contributor

emilio commented Nov 12, 2016

@bors-servo r+

Perfect, thanks!

@bors-servo
Copy link

📌 Commit 5851026 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit 5851026 with merge bdfab64...

bors-servo pushed a commit that referenced this pull request Nov 12, 2016
Add support for bindings to overloaded functions

This commit (re)adds support for generating bindings to overloaded
functions. First, we use the symbol name instead of the canonical name
when checking if we have already generated bindings for a given
function. Second, we add a map from canonical names to number of times
we have generated a function with that canonical name. We increment this
number every time we generate a function. When the number is greater
than zero, we append it to the function name so that overloaded
functions get a unique Rust symbol.

Fixes #239

r? @emilio
@bors-servo
Copy link

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 5851026 into rust-lang:master Nov 12, 2016
@fitzgen fitzgen deleted the overloads branch November 12, 2016 01:26
@hoodie
Copy link

hoodie commented Nov 21, 2016

As this solution seems to only use the order of appearance - could this result in conflicts if the order of overrides changes in the source?

@fitzgen
Copy link
Member Author

fitzgen commented Nov 21, 2016

As this solution seems to only use the order of appearance - could this result in conflicts if the order of overrides changes in the source?

Yes. In general, if the source changes, the bindings are likely to as well.

luser pushed a commit to luser/rust-bindgen that referenced this pull request Mar 27, 2017
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.

5 participants