Repository navigation
chore(quest): plan keeping a pushed Vec's capacity as it shrinks - #531
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 45 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
kixelated
enabled auto-merge
November 3, 2026 14:55
kixelated
disabled auto-merge
November 3, 2026 14:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TS loses a
Vec's capacity when the length drops, if that capacity came only from pushes. Six pushes of 1280-byte elements, thenclear: native Rust reports 8, TS reports 0. std documents thatclearandtruncateleave the capacity unchanged, and aVecnever shrinks on its own. So the guarantee-only capacity model decided on 2026-11-01 must keep it.Approach
quest/m3/ts-vec-clear-capacity.md, linked fromquest/m3/README.mdjust above the exact-capacity quest.rt.vecCloneFrom, before its own truncate, and leavesrt.vecTruncateand the other steps unchanged. moq-dev/rust2#522 already fixed aVecmade from a deque.3c1fab74) with a scratch crate: aVec<[u64; 160]>, six pushes, then one step.clear, popping until empty,drain(..),retainof none, andresize(0, _); 1 aftertruncate(1)anddedupto one; 2 aftersplit_off(2).removeandswap_removeonly because five elements still imply 8.clone_fromreports 8, which feat(ts): clone_from through containers of values that drop, in std's order #527 fixed.capacityfixture'sKnownchecks capacity only against a floor thatwith_capacityorreserveset, so the fixture misses this.push/stackfirst.ts-vec-exact-capacity.mdand the new quest each link the other under## Related.ts-clone-from-capacity.mdthrough feat(ts): clone_from through containers of values that drop, in std's order #527's URL. That file is not onmainyet, andquest checkrefuses a path link that does not resolve.Impact
Alternatives
ts-vec-exact-capacity.md: that quest is about std's exact capacity, which the maintainer chose to leave open. This one is a guarantee.Follow-ups
ts-clone-from-capacity.mdinto a path link.Review
Skipped: a quest-only change of planning prose.
just checkpassed on head5693d2aa36cc1cf3f186c6aff014f5216436897d.🤖 Generated with Claude Code