Rollup of 2 pull requests#158538
Closed
jhpratt wants to merge 5 commits into
Closed
Conversation
but RangeInclusive loops do not
and optimize the RangeInclusive iterator implementation with them This changes the `exhausted` field to represent an overflow flag for the bounds, essentially acting as an extra bit for `Idx`. This was found to enable optimizations previously only applicable to the exclusive-ended Range type. - change end_bound to return Excluded(start) when exhausted - add contains to tests - make into_bounds panic when exhausted matches From<legacy::RangeInclusive<T>> for RangeInclusive<T>
…rk-Simulacrum Include AtomicU128/AtomicI128 in docs for any target Fixes rust-lang#130474 This is my first contribution, so I'll try to be as descriptive as possible of my process and thoughts. - **Environment**: Cross compiled in Macbook M1 Air - **Testing**: I replicated the bug and checked fixes with `./x doc library/core --target x86_64-unknown-linux-gnu` (building the std doc didn't seem to apply my local changes so I used the core doc) Check the screenshots below. - **Diffs**: I added `#[cfg(any(...,doc))]` to all required structs and implementations so the types would compile. Applying`target_has_atomic_equal_alignment` part wasn't explicitly necessary, but adding it reveals the whole methods (specifically `from_mut` and `from_mut_slice`). - **Thoughts**: Also wondered if additional messages should be written to notify the available targets, but the documentation already included the following sentence that seemed enough. - **Note:** This type is only available on platforms that support atomic loads and stores of `u128`/`i128` [Before] <img width="988" height="233" alt="image" src="https://github.com/user-attachments/assets/e22137c2-dfc9-4239-bd0d-75c5a2e2b84f" /> [After] <img width="988" height="281" alt="image" src="https://github.com/user-attachments/assets/8ae83cb0-46f5-4cff-a576-2183466c202f" /> --- After the first work, doc tests were failing in CI, so I added `#[$cfg_cas]` to all methods in the `atomic_int` macro to cover them. But I'm not really sure if all these changes are necessary (and appropriate). This also has a side-effect of stating "Available on target_has_atomic=128 only." for all methods with the attribute. Also not sure if this is a good behavior.. <img width="978" height="454" alt="image" src="https://github.com/user-attachments/assets/b052f713-c8a9-4314-96be-a2832a6b84f6" />
… r=Mark-Simulacrum Add `Step::forward/backward_overflowing` to enable RangeInclusive loop optimizations ACP: rust-lang/libs-team#767 This adds new required methods to the Step trait: ```rust trait Step: ... { // ... existing functions // New required functions fn forward_overflowing(start: Self, count: usize) -> (Self, bool); fn backward_overflowing(start: Self, count: usize) -> (Self, bool); } ``` It was found that using these to implement RangeInclusive's Iterator impl enabled optimizations previously only applicable to the exclusive-ended `Range`. This required changing how "exhaustion" works for `RangeInclusive`. I've nominated this for libs-api discussion because of one insta-stable change: The new implementations now only set `exhausted` when overflow occurs, and `start` is now advanced past `end` otherwise. I doubt anyone depends on the prior behavior, but it's probably worth a crater run. The exhaustion changes also affect `Debug` but my understanding is that debug formatting is never guaranteed stable. I have now changed the `nth` impls to use the new functions as well. r? libs
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
This comment has been minimized.
This comment has been minimized.
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 3b492e0 failed: CI. Failed job:
|
Contributor
|
PR #155114, which is a member of this rollup, was unapproved. |
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.
Successful merges:
Step::forward/backward_overflowingto enable RangeInclusive loop optimizations #155114 (AddStep::forward/backward_overflowingto enable RangeInclusive loop optimizations)r? @ghost
Create a similar rollup