rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Generated name override

Open justsmth opened this issue 3 years ago • 2 comments

Addresses issue: https://github.com/rust-lang/rust-bindgen/issues/1375

  • Adds generated_name_override callback to the ParseCallbacks trait.
  • Callback is invoked for each function name (after other name-related logic).
  • Added test to verify.

This PR is a cleaned up version of previous: https://github.com/rust-lang/rust-bindgen/pull/2214

justsmth avatar Jun 23 '22 16:06 justsmth

@justsmth I have one question. What happens if you use this new callback to set all the function names to the same value?

pvdrz avatar Sep 09 '22 15:09 pvdrz

@justsmth I have one question. What happens if you use this new callback to set all the function names to the same value?

I've not tried that, but at best the bindings generated would not compile due to name conflicts. We could potentially detect/prevent such a mistake within rust-bindgen. However, I'm not sure doing so would be worth the added complexity.

justsmth avatar Sep 09 '22 15:09 justsmth

:umbrella: The latest upstream changes (presumably #2284) made this pull request unmergeable. Please resolve the merge conflicts.

bors-servo avatar Oct 05 '22 01:10 bors-servo