Add slice::try_range by clarfonthey · Pull Request #121148 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation7 Commits1 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
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.
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 added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the library team, which will review and decide on the PR/issue.
labels
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 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
Isn't it better to implement range()
via try_range()
?
Isn't it better to implement
range()
viatry_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
.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
📌 Commit 290cbdf has been approved by dtolnay
It is now in the queue for this repository.
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
jhpratt added a commit to jhpratt/rust that referenced this pull request
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
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
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
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
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.
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the library API team, which will review and decide on the PR/issue.