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

C API doesn't let you tell the difference between too small buffer and non-Rust symbol #68

Open
VorpalBlade opened this issue Mar 23, 2024 · 0 comments

Comments

@VorpalBlade
Copy link

// Demangles symbol given in `mangled` argument into `out` buffer
//
// Returns 0 if `mangled` is not Rust symbol or if `out` buffer is too small
// Returns 1 otherwise
int rustc_demangle(const char *mangled, char *out, size_t out_size);
shows that the same return code is used for both "not a rust symbol" and "too small buffer" in the C API. This is very unfortunate, as it makes it impossible to tell these cases apart.

This causes KDAB/hotspot#611 where hotspot will not demangle some long symbol names correctly. Consider making a breaking change (or adding an alternative function) whereby it is possible to tell these cases apart. Best would be if it would report how large the buffer would need to be.

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

No branches or pull requests

1 participant