Skip to content

Conversation

UserIsntAvailable
Copy link
Contributor

Closes #119128

For the const version of slice::split_at_mut_checked, I'm reusing the const_slice_split_at_mut feature flag (#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...

@rustbot
Copy link
Collaborator

rustbot commented May 3, 2024

r? @m-ou-se

rustbot has assigned @m-ou-se.
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 May 3, 2024
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

I had a PR in the works and came up with the same thing, you beat me to it :)

This PR makes the following API stable:

impl<T> [T] {
    // Stabilized as const
    pub const fn split_at_checked(&self, mid: usize) -> Option<(&[T], &[T])>;
    
    // Const stability moved to `const_slice_split_at_mut`
    pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut [T], &mut [T])>;
}

impl str {
    pub fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)>;
    pub fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)>;
}

@jhpratt
Copy link
Member

jhpratt commented May 4, 2024

Reusing the feature flag for const is reasonable imo.

@bors r+

@bors
Copy link
Collaborator

bors commented May 4, 2024

📌 Commit 4c286c7 has been approved by jhpratt

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 May 4, 2024
compiler-errors added a commit to compiler-errors/rust that referenced this pull request May 4, 2024
…plit-at-checked, r=jhpratt

Stabilize `split_at_checked`

Closes rust-lang#119128

For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (rust-lang#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#124418 (Use a proof tree visitor to refine the `Obligation` for error reporting in new solver)
 - rust-lang#124480 (Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`)
 - rust-lang#124648 (Trim crate graph)
 - rust-lang#124656 (release notes 1.78: add link to interior-mut breaking change)
 - rust-lang#124658 (Migrate `run-make/doctests-keep-binaries` to new rmake.rs format)
 - rust-lang#124678 (Stabilize `split_at_checked`)
 - rust-lang#124681 (zkvm: fix run_tests)
 - rust-lang#124687 (Make `Bounds.clauses` private)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 93ca906 into rust-lang:master May 4, 2024
@rustbot rustbot added this to the 1.80.0 milestone May 4, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
Rollup merge of rust-lang#124678 - UserIsntAvailable:feat/stabilize-split-at-checked, r=jhpratt

Stabilize `split_at_checked`

Closes rust-lang#119128

For the const version of `slice::split_at_mut_checked`, I'm reusing the `const_slice_split_at_mut` feature flag (rust-lang#101804). I don't if it okay to reuse tracking issues or if it preferred to create new ones...
@UserIsntAvailable UserIsntAvailable deleted the feat/stabilize-split-at-checked branch May 4, 2024 16:23
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 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.

Tracking Issue for split_at_checked
6 participants