Skip to content

Rollup of 2 pull requests#158538

Closed
jhpratt wants to merge 5 commits into
rust-lang:mainfrom
jhpratt:rollup-iTiDbgD
Closed

Rollup of 2 pull requests#158538
jhpratt wants to merge 5 commits into
rust-lang:mainfrom
jhpratt:rollup-iTiDbgD

Conversation

@jhpratt

@jhpratt jhpratt commented Jun 29, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

pitaj and others added 5 commits June 13, 2026 10:54
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
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 29, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 29, 2026
@jhpratt

jhpratt commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7d2cdaf has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 29, 2026
Rollup of 2 pull requests

Successful merges:

 - #155811 (Include AtomicU128/AtomicI128 in docs for any target)
 - #155114 (Add `Step::forward/backward_overflowing` to enable RangeInclusive loop optimizations)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 29, 2026
@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 3b492e0 failed: CI. Failed job:

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2026
@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

PR #155114, which is a member of this rollup, was unapproved.

@jhpratt jhpratt closed this Jun 29, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 29, 2026
@jhpratt jhpratt deleted the rollup-iTiDbgD branch June 29, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants