Skip to content

Weaken guarantee for From<legacy::RangeInclusive> for RangeInclusive#158770

Open
theemathas wants to merge 2 commits into
rust-lang:mainfrom
theemathas:range-inclusive-from
Open

Weaken guarantee for From<legacy::RangeInclusive> for RangeInclusive#158770
theemathas wants to merge 2 commits into
rust-lang:mainfrom
theemathas:range-inclusive-from

Conversation

@theemathas

@theemathas theemathas commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@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 Jul 4, 2026
@rustbot

rustbot commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
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: libs
  • libs expanded to 12 candidates
  • Random selection from 6 candidates

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b570ebd has been approved by JohnTitor

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 2. This pull request will be tested once the tree is reopened.

@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 Jul 5, 2026
@JohnTitor

Copy link
Copy Markdown
Member

(not beta-nominated but if the promotion happens meanwhile, please add the label)

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

Copy link
Copy Markdown
Contributor

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`


try-job: test-various
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 5, 2026
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

💔 Test for e35034e failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@theemathas

Copy link
Copy Markdown
Contributor Author

Does catch_unwind not work on wasm?

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors r-

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 5, 2026
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#158806), which was unapproved.

View changes since this unapproval

@theemathas

Copy link
Copy Markdown
Contributor Author

The test failed because wasm32-wasip1 is compiled with -Cpanic=abort by default. The doctest for catch_unwind itself doesn't fail for a similar reason, because the CI setup for wasm32-wasip1 doesn't run library/std tests, and catch_unwind is in std. The CI for this target, however, runs library/core tests, which includes this PR's test in core.

@theemathas

Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
Weaken guarantee for `From<legacy::RangeInclusive> for RangeInclusive`
@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: e293995 (e293995c615d98a73788f901c1dbe514f04a15ec)
Base parent: 4eb6253 (4eb62535fc12dd1a63fd43a4173e224e79313c4d)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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