Skip to content

[Backport releases/v4.35.0] fix: preserve sticky counts in deletion cascades - #15301

Merged
Kha merged 1 commit into
releases/v4.35.0from
backport-15241-to-releases/v4.35.0
Sep 24, 2026
Merged

Kha merged 1 commit into
releases/v4.35.0from
backport-15241-to-releases/v4.35.0

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport 8546083 from #15241.

This PR prevents deletion cascades from releasing objects whose
reference count has been frozen after over- or underflow.

The public decrement path already stops at `LEAN_RC_STICKY_DROP`, but
the internal cascade helper `dec` only stopped for persistent objects.
Replace that zero test with an unsigned comparison against the drop
threshold, which handles persistent and sticky counts together while
live thread-shared counts continue to the atomic path.

`cascade_dec_guard_eq_never_freed` in `tests/elab/rc_model.lean` checks
the new guard exhaustively over every count that can reach this branch.
The sticky-count semantics were introduced in #14838, and the
reference-count model extended here was completed in #14910.

---------

Co-authored-by: Sebastian Ullrich <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 8546083)
@Kha
Kha merged commit c8a2a2d into releases/v4.35.0 Sep 24, 2026
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

Successfully merging this pull request may close these issues.

2 participants