Fix a bug in ChunkedBitSet::subtract#155381
Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom Apr 28, 2026
Merged
Conversation
It results in `b64` having many fewer bits set than it should. LLM disclosure: this bug was identified by Claude Code. I did everything else.
It does a masking operation but the mask is computed incorrectly due to operator precedence. The mask is of the form `1 << N - 1` but it should be `(1 << N) - 1` because `-` binds tighter than `1 << N`. This commit fixes the problem, not by adjusting the precedence, but by instead using the existing `clear_excess_bits_in_final_word`, which is consistent with other similar operations. LLM disclosure: this bug was identified by Claude Code. I did everything else.
Member
|
Precautionary perf run: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Apr 26, 2026
Fix a bug in `ChunkedBitSet::subtract`
Member
|
Looks good, r=me if perf is unsurprising. |
Contributor
This comment has been minimized.
This comment has been minimized.
Collaborator
|
Finished benchmarking commit (89be914): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 488.457s -> 488.608s (0.03%) |
Member
|
@bors rollup=maybe |
Contributor
Author
|
@bors r=Zalathar |
Contributor
Member
|
r? me |
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Apr 28, 2026
…ract, r=Zalathar Fix a bug in `ChunkedBitSet::subtract` An operator precedence bug means an incorrect mask is used in `ChunkedBitSet::subtract`. Details in individual commits. r? @dingxiangfei2009
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Apr 28, 2026
…ract, r=Zalathar Fix a bug in `ChunkedBitSet::subtract` An operator precedence bug means an incorrect mask is used in `ChunkedBitSet::subtract`. Details in individual commits. r? @dingxiangfei2009
This was referenced Apr 28, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Apr 28, 2026
Rollup of 9 pull requests Successful merges: - #155381 (Fix a bug in `ChunkedBitSet::subtract`) - #155847 (Don't reload length in String::push) - #155858 (`slice::join`: borrow only once during length calc) - #155879 (enable pipe tests in Miri) - #155905 (Update LLVM to 22.1.4 (again)) - #155247 ([AIX] update linker default to bcdtors) - #155812 ([codex] tests: mark migrated UI tests as check-pass) - #155854 (Rename the diagnostic item for `std::sync::mpsc::Receiver`) - #155882 (Add regression test for #101363)
rust-timer
added a commit
that referenced
this pull request
Apr 28, 2026
Rollup merge of #155381 - nnethercote:fix-ChunkedBitSet-subtract, r=Zalathar Fix a bug in `ChunkedBitSet::subtract` An operator precedence bug means an incorrect mask is used in `ChunkedBitSet::subtract`. Details in individual commits. r? @dingxiangfei2009
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.
An operator precedence bug means an incorrect mask is used in
ChunkedBitSet::subtract. Details in individual commits.r? @dingxiangfei2009