Skip to content

fix: IOReader::decrement_depth can underflow while SliceReader guards against zero#33

Merged
nuskey8 merged 3 commits into
nuskey8:mainfrom
paq:depth_decrements
Apr 24, 2026
Merged

fix: IOReader::decrement_depth can underflow while SliceReader guards against zero#33
nuskey8 merged 3 commits into
nuskey8:mainfrom
paq:depth_decrements

Conversation

@paq
Copy link
Copy Markdown
Contributor

@paq paq commented Apr 11, 2026

Unify the inconsistent behaviors.

Copilot AI review requested due to automatic review settings April 11, 2026 03:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a depth-tracking bug in the IOReader implementation by aligning its decrement_depth behavior with SliceReader, preventing usize underflow when called at depth 0.

Changes:

  • Guarded IOReader::decrement_depth so it no-ops when depth == 0 (matching SliceReader).
  • Added unit tests validating decrement behavior at depth 0 and depth 1 for both readers (with IOReader tests gated behind feature = "std").

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paq paq force-pushed the depth_decrements branch from 4a9173d to b917b58 Compare April 17, 2026 22:14
@nuskey8 nuskey8 merged commit 7a81de7 into nuskey8:main Apr 24, 2026
2 checks passed
@paq paq deleted the depth_decrements branch May 12, 2026 00:33
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.

3 participants