Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slice::try_range #121148

Merged
merged 1 commit into from Mar 11, 2024
Merged

Add slice::try_range #121148

merged 1 commit into from Mar 11, 2024

Conversation

clarfonthey
Copy link
Contributor

This adds a fallible version of the unstable slice::range (tracking: #76393) which is highly requested in the tracking issue.

Hoping this can slide by without an ACP (since the feature is already being tracked), but let me know otherwise.

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2024

r? @cuviper

rustbot has assigned @cuviper.
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

@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 Feb 15, 2024
@cuviper
Copy link
Member

cuviper commented Feb 15, 2024

Hoping this can slide by without an ACP (since the feature is already being tracked), but let me know otherwise.

I think it should at least get an API reviewer...

@rustbot label -T-libs +T-libs-api
r? libs-api

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 15, 2024
@rustbot rustbot assigned dtolnay and unassigned cuviper Feb 15, 2024
@ChayimFriedman2
Copy link
Contributor

Isn't it better to implement range() via try_range()?

@clarfonthey
Copy link
Contributor Author

Isn't it better to implement range() via try_range()?

No, because the error returned by range is more granular than try_range.

One thing I was considering when making this PR was to introduce a granular error type and make try_range return a Result (which does match the try naming), although I ultimately decided against this since this is rather unprecedented in the standard library, and most similar methods just return Option.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you!

@dtolnay
Copy link
Member

dtolnay commented Mar 11, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Mar 11, 2024

📌 Commit 290cbdf has been approved by dtolnay

It is now in the queue for this repository.

@bors bors 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 Mar 11, 2024
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 11, 2024
Add slice::try_range

This adds a fallible version of the unstable `slice::range` (tracking: rust-lang#76393) which is highly requested in the tracking issue.

Hoping this can slide by without an ACP (since the feature is already being tracked), but let me know otherwise.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#121148 (Add slice::try_range)
 - rust-lang#121573 (unix_sigpipe: Add test for SIGPIPE disposition in child processes)
 - rust-lang#121633 (Win10: Use `GetSystemTimePreciseAsFileTime` directly)
 - rust-lang#121840 (Expose the Freeze trait again (unstably) and forbid implementing it manually)
 - rust-lang#121907 (skip sanity check for non-host targets in `check` builds)
 - rust-lang#122002 (std::threads: revisit stack address calculation on netbsd.)
 - rust-lang#122108 (Add `target.*.runner` configuration for targets)
 - rust-lang#122298 (RawVec::into_box: avoid unnecessary intermediate reference)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#121148 (Add slice::try_range)
 - rust-lang#121633 (Win10: Use `GetSystemTimePreciseAsFileTime` directly)
 - rust-lang#121840 (Expose the Freeze trait again (unstably) and forbid implementing it manually)
 - rust-lang#121907 (skip sanity check for non-host targets in `check` builds)
 - rust-lang#122002 (std::threads: revisit stack address calculation on netbsd.)
 - rust-lang#122108 (Add `target.*.runner` configuration for targets)
 - rust-lang#122298 (RawVec::into_box: avoid unnecessary intermediate reference)
 - rust-lang#122315 (Allow multiple `impl Into<{D,Subd}iagMessage>` parameters in a function.)
 - rust-lang#122326 (Optimize `process_heap_alloc`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6c8c272 into rust-lang:master Mar 11, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2024
Rollup merge of rust-lang#121148 - clarfonthey:try-range, r=dtolnay

Add slice::try_range

This adds a fallible version of the unstable `slice::range` (tracking: rust-lang#76393) which is highly requested in the tracking issue.

Hoping this can slide by without an ACP (since the feature is already being tracked), but let me know otherwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants