Skip to content

Document panic in RangeInclusive::from(legacy::RangeInclusive)#155421

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
tbu-:pr_rangeinclusive_from_panic
Jun 21, 2026
Merged

Document panic in RangeInclusive::from(legacy::RangeInclusive)#155421
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
tbu-:pr_rangeinclusive_from_panic

Conversation

@tbu-

@tbu- tbu- commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 17, 2026
@rustbot

rustbot commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 7 candidates
  • Random selection from Mark-Simulacrum, jhpratt, scottmcm

@jhpratt

jhpratt commented Apr 17, 2026

Copy link
Copy Markdown
Member

Has this been approved by T-libs-api? The panic message clearly says unspecified, so adding this documentation would overrule that.

@tbu-

tbu- commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

If T-libs doesn't want to guarantee this, I can change the wording to "currently panics, may not panic in the future". Or even "may panic".

@rust-log-analyzer

This comment has been minimized.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from 766773c to f43e3e7 Compare April 17, 2026 08:35
@fmease

fmease commented Apr 17, 2026

Copy link
Copy Markdown
Member

#155394

@rust-log-analyzer

This comment has been minimized.

@Amanieu

Amanieu commented Apr 27, 2026

Copy link
Copy Markdown
Member

ping @tbu-, CI is failing. You need to add #![feature(new_range_api_legacy)] to the doc tests or import the old range types from core::ops instead.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from f43e3e7 to 73b9155 Compare April 28, 2026 13:53
@rust-log-analyzer

This comment has been minimized.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from 73b9155 to 70df721 Compare April 28, 2026 15:08
@tbu-

tbu- commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the ping, @Amanieu. I somehow forgot about this PR.

@rust-log-analyzer

This comment has been minimized.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from 70df721 to 6502d57 Compare April 28, 2026 19:50
@rust-log-analyzer

This comment has been minimized.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from 6502d57 to 5a00cc6 Compare April 28, 2026 21:14
@theemathas

Copy link
Copy Markdown
Contributor

Note: The current status of the PR adds a new stable guarantee that the conversion will panic for an exhausted iterator.

@jhpratt jhpratt added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label May 30, 2026
@jhpratt

jhpratt commented May 30, 2026

Copy link
Copy Markdown
Member

Nominating given the implicit stability guarantee.

@jhpratt jhpratt added S-waiting-on-t-libs-api Status: Awaiting decision from T-libs-api and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 30, 2026
@rust-bors

This comment has been minimized.

@joshtriplett joshtriplett added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jun 2, 2026
@joshtriplett

Copy link
Copy Markdown
Member

@rfcbot merge libs-api

@rust-rfcbot

rust-rfcbot commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

@joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jun 2, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 21, 2026
@rust-log-analyzer

This comment has been minimized.

@jhpratt

jhpratt commented Jun 21, 2026

Copy link
Copy Markdown
Member

@bors r-

@bors delegate+

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2026
@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

✌️ @tbu-, you can now approve this pull request!

If @jhpratt told you to "r=me" after making some further change, then please make that change and post @bors r=jhpratt.

View changes since this delegation.

@tbu- tbu- force-pushed the pr_rangeinclusive_from_panic branch from 4ff75dc to 48d2671 Compare June 21, 2026 10:00
@tbu-

tbu- commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=jhpratt

@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 48d2671 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 21, 2026
@rust-bors

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  IMAGE: x86_64-gnu-miri
##[endgroup]
    Updating crates.io index
error: failed to get `simd-adler32` as a dependency of package `miniz_oxide v0.8.8`
    ... which satisfies dependency `miniz_oxide = "^0.8.5"` of package `flate2 v1.1.9`
    ... which satisfies dependency `flate2 = "^1.1.9"` of package `citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)`

Caused by:
  failed to load source for dependency `simd-adler32`

Caused by:

@theemathas

Copy link
Copy Markdown
Contributor

@bors retry

@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

❗ You can only retry pull requests that are approved and have a previously failed auto build.

Hint: There is currently a pending auto build on this PR. To cancel it, run @bors cancel.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2026
@rust-bors

rust-bors Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 9m 28s
Pushing 40f92b3 to main...

@rust-bors rust-bors Bot merged commit 40f92b3 into rust-lang:main Jun 21, 2026
3 of 14 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing a774017 (parent) -> 40f92b3 (this PR)

Test differences

Show 32 test diffs

32 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 40f92b37c4f7566de7348cec4d4c2a350da598d5 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. i686-gnu-nopt-2: 2h 18m -> 1h 26m (-37.6%)
  2. x86_64-msvc-ext1: 2h 11m -> 1h 23m (-36.9%)
  3. x86_64-gnu-llvm-21-2: 1h 33m -> 1h (-35.0%)
  4. dist-i686-mingw: 2h 1m -> 2h 37m (+30.3%)
  5. x86_64-gnu-gcc: 1h 5m -> 47m 6s (-28.4%)
  6. dist-arm-linux-musl: 1h 19m -> 1h 37m (+23.2%)
  7. dist-i686-linux: 1h 46m -> 1h 28m (-16.6%)
  8. dist-android: 24m 1s -> 27m 57s (+16.4%)
  9. aarch64-apple-macos-26: 2h 25m -> 2h 45m (+14.1%)
  10. dist-apple-various: 1h 46m -> 1h 59m (+11.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (40f92b3): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary -4.0%, secondary 2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
-4.0% [-5.9%, -2.0%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.0% [-5.9%, -2.0%] 2

Cycles

Results (secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [2.3%, 2.8%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 482.353s -> 479.892s (-0.51%)
Artifact size: 390.76 MiB -> 390.75 MiB (-0.00%)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 5, 2026
…=JohnTitor

Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`

As per rust-lang#155114 (comment), this `From` impl no longer guarantees panicking for exhausted iterators. Instead, it only guarantees that the conversion will either panic or produce an empty range.

This is done so that we can optimize the implementation of `legacy::RangeInclusive` in a way such that we cannot check if it has been exhausted in a generic context without a `Step` and/or `PartialOrd` bound.

If this PR and/or rust-lang#155114 merges after the 1.98.0 beta branch promotion from the main branch, then this will need a beta backport, since this PR changes the stable guarantee previously made in rust-lang#155421.

This PR conflicts with and/or blocks rust-lang#155114.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 6, 2026
…=JohnTitor

Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`

As per rust-lang#155114 (comment), this `From` impl no longer guarantees panicking for exhausted iterators. Instead, it only guarantees that the conversion will either panic or produce an empty range.

This is done so that we can optimize the implementation of `legacy::RangeInclusive` in a way such that we cannot check if it has been exhausted in a generic context without a `Step` and/or `PartialOrd` bound.

If this PR and/or rust-lang#155114 merges after the 1.98.0 beta branch promotion from the main branch, then this will need a beta backport, since this PR changes the stable guarantee previously made in rust-lang#155421.

This PR conflicts with and/or blocks rust-lang#155114.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 6, 2026
…=JohnTitor

Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`

As per rust-lang#155114 (comment), this `From` impl no longer guarantees panicking for exhausted iterators. Instead, it only guarantees that the conversion will either panic or produce an empty range.

This is done so that we can optimize the implementation of `legacy::RangeInclusive` in a way such that we cannot check if it has been exhausted in a generic context without a `Step` and/or `PartialOrd` bound.

If this PR and/or rust-lang#155114 merges after the 1.98.0 beta branch promotion from the main branch, then this will need a beta backport, since this PR changes the stable guarantee previously made in rust-lang#155421.

This PR conflicts with and/or blocks rust-lang#155114.
rust-timer added a commit that referenced this pull request Jul 6, 2026
Rollup merge of #158770 - theemathas:range-inclusive-from, r=JohnTitor

Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`

As per #155114 (comment), this `From` impl no longer guarantees panicking for exhausted iterators. Instead, it only guarantees that the conversion will either panic or produce an empty range.

This is done so that we can optimize the implementation of `legacy::RangeInclusive` in a way such that we cannot check if it has been exhausted in a generic context without a `Step` and/or `PartialOrd` bound.

If this PR and/or #155114 merges after the 1.98.0 beta branch promotion from the main branch, then this will need a beta backport, since this PR changes the stable guarantee previously made in #155421.

This PR conflicts with and/or blocks #155114.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.