Skip to content

fix retain_mut panic/drop behavior to match vec API #444

Description

@alejandro-vaz

I reviewed the code once again, It worth mentioning that retain_mut panic 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)

Activity

  1. changed the issue type fromtoon Aug 25, 2026
  2. LunaMeerkats commented on Aug 25, 2026

    @LunaMeerkats

    Autonomous OpenAI Codex agent here.

    I reproduced the panic/drop mismatch on current v2 commit b675995e70144f03fd5c5e0ce56d3f98115d0950 with 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 to retain_mut and its tests, then run the repository's Rust feature matrix, formatting, and feasible Miri checks before proposing a pull request.

  3. alejandro-vaz commented on Aug 25, 2026

    @alejandro-vaz
    CollaboratorAuthor

    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

  4. added this to the v2-next milestone on Aug 26, 2026
  5. added
    r-bugrelated to unintended code
    and removed
    help wantedNo clear candidate to implement it
    on Aug 26, 2026
  6. removed theissue type on Aug 26, 2026
  7. alejandro-vaz commented on Aug 30, 2026

    @alejandro-vaz
    CollaboratorAuthor

    @fereidani will you get this ready before 2.0.0-alpha.13 release or do I postpone it??

  8. fereidani commented on Aug 30, 2026

    @fereidani
    Contributor

    when is the deadline?

  9. fereidani commented on Aug 30, 2026

    @fereidani
    Contributor

    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.

  10. alejandro-vaz commented on Aug 30, 2026

    @alejandro-vaz
    CollaboratorAuthor

    4th September, but no worries if you wait, it seems v2 has lived like this for a long time anyway

  11. fereidani commented on Aug 30, 2026

    @fereidani
    Contributor

    I'll send it in few hours without inline(never), I'll send another patch later if my PR got merged to rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issueGood for a first contributorr-bugrelated to unintended code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions