Optimize slice::contains for one-byte BytewiseEq types - #160732
Merged
rust-bors[bot] merged 3 commits intoAug 9, 2026
Merged
Conversation
Collaborator
|
r? @clarfonthey rustbot has assigned @clarfonthey. Use Why was this reviewer chosen?The reviewer was selected based on:
|
joboet
approved these changes
Aug 8, 2026
| // slice can be read as `u8`s. | ||
| let (byte, bytes) = unsafe { | ||
| ( | ||
| *(self as *const Self).cast::<u8>(), |
Member
There was a problem hiding this comment.
A style suggestion: why not use transmute_copy here?
Suggested change
| *(self as *const Self).cast::<u8>(), | |
| transmute_copy::<T, u8>(self) |
Contributor
|
r? joboet |
Collaborator
|
|
This comment has been minimized.
This comment has been minimized.
Contributor
|
@bors r=joboet Thank you! |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 8, 2026
…uwer Rollup of 9 pull requests Successful merges: - #156935 (Introduce a `PinSafePointer` trait that generalizes `PinCoerceUnsized`) - #159834 (Apply str debugger visualizer to `*const str`, `*mut str` and `Box<str>`) - #160663 (Suggest add async for function sig with return expr in body) - #160732 (Optimize slice::contains for one-byte BytewiseEq types) - #157944 (Make `char::is_default_ignorable` unstably public) - #158835 (rustc_passes: lint unused `#[path]` attributes on inline modules) - #160754 (Rename more diagnostic files to `diagnostics.rs`) - #160755 (Merge `rustc_lint/lints.rs` into `diagnostics.rs`) - #160757 (Merge `rustc_attr_parsing/session_diagnostics.rs` into `diagnostics.rs`)
rust-timer
added a commit
that referenced
this pull request
Aug 9, 2026
Rollup merge of #160732 - SomeFlyingThing:agent/optimize-bytewise-contains, r=joboet Optimize slice::contains for one-byte BytewiseEq types add optimized searches for NonZeroI8, option<NonZeroI8> ordering, and other one-byte types
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.
add optimized searches for NonZeroI8, option ordering, and other one-byte types