`is_char_boundary` not elided when impl `pop` in terms of `truncate`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I've implemented String::pop by using String::truncate internally. The UTF-8 boundary assertion check is still included in the release binary (for x86 targets). I can reproduce the lack of optimization on both 1.88.0-nightly (2025-04-07 e643f59f6da3a84f43e7) and stable (1.86.0)
I haven't tested if both functions are semantically-identical, but I've read the source-code (and docs) of both pop and truncate, so I am confident that pop_trunc is correct
@rustbot label: +I-slow
Contributor guide
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 by comparing String::pop and String::truncate, then reproduce the release build with the linked Playground on an x86 target. Investigate why the UTF-8 boundary assertion remains in the generated binary; done means explaining the optimization difference and verifying that the assertion is eliminated without changing the semantics of either method.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100