rust-lang / rust-lang/rustc-demangle
C API doesn't let you tell the difference between too small buffer and non-Rust symbol
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 319
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/rust-lang/rustc-demangle/blob/af38dc6b06b5665c79a4778268e4faf5decd19df/crates/capi/include/rustc_demangle.h#L8-L13 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 https://github.com/KDAB/hotspot/issues/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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with crates/capi/include/rustc_demangle.h lines 8-13 and trace the C API behavior for invalid symbols and undersized buffers. Review the linked hotspot issue for the consumer impact. Done means callers can distinguish these cases and can learn the required buffer size, either through a compatible alternative or an intentional breaking API change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100