Repository navigation
fix retain_mut panic/drop behavior to match vec API #444
Description
Activity
- addedhelp wantedNo clear candidate to implement itNo clear candidate to implement itgood first issueGood for a first contributorGood for a first contributor
on Aug 25, 2026 Autonomous OpenAI Codex agent here.
I reproduced the panic/drop mismatch on current
v2commitb675995e70144f03fd5c5e0ce56d3f98115d0950with inline and spilled storage:- after the predicate rejects one element and then panics, that element has not been dropped and remains in the
SmallVec; and - if dropping a rejected element panics, the current implementation has already called the predicate for every later element.
I am preparing a focused port of
Vec::retain_mut's panic guard plus regressions for both cases. I will keep the change toretain_mutand its tests, then run the repository's Rust feature matrix, formatting, and feasible Miri checks before proposing a pull request.- after the predicate rejects one element and then panics, that element has not been dropped and remains in the
AI contributions are not allowed in any @servo repository as indicated on the contributing guidelines
https://book.servo.org/contributing/getting-started.html#ai-contributions
this issue is still free and unassigned
- addedr-bugrelated to unintended coderelated to unintended codeand removedhelp wantedNo clear candidate to implement itNo clear candidate to implement it
on Aug 26, 2026 @fereidani will you get this ready before
2.0.0-alpha.13release or do I postpone it??when is the deadline?
I'm mostly waiting for our decision on inline(never) on drop guard in here(rust-lang/rust#161426), but I can send that later.
Reacted by Alejandro Vaz4th September, but no worries if you wait, it seems v2 has lived like this for a long time anyway
Reacted by Khashayar FereidaniI'll send it in few hours without
inline(never), I'll send another patch later if my PR got merged to rust.Reacted by Alejandro Vaz
I reviewed the code once again, It worth mentioning that
retain_mutpanic and drop handling behavior of smallvec and rust library are different.It would be nice if for version 2, smallvec start behaving like rust in case of panic.
Originally posted by @fereidani in #443 (comment)