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

Stabilize const_slice_split_at_mut and const_slice_first_last_chunk #130428

Merged

Conversation

onestacked
Copy link
Contributor

@onestacked onestacked commented Sep 16, 2024

Stabilizes #101804 and the remainder of #111774.

FCP proposed in the tracking issue.

Requires #130403 (or it would need a rustc_allow_const_fn_unstable for it)

Stabilized const API:

// slice
impl [T] {
    pub const fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_unchecked(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut [T], &mut [T])>;

    pub const fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn split_first_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
    pub const fn split_last_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
}

Closes #101804
Closes #111774

cc @RalfJung

@rustbot
Copy link
Collaborator

rustbot commented Sep 16, 2024

Failed to set assignee to gohst: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@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 Sep 16, 2024
@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

Cc @rust-lang/wg-const-eval

@RalfJung RalfJung added the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Sep 16, 2024
@bors
Copy link
Contributor

bors commented Sep 24, 2024

☔ The latest upstream changes (presumably #130738) made this pull request unmergeable. Please resolve the merge conflicts.

@workingjubilee
Copy link
Member

workingjubilee commented Sep 29, 2024

r? @workingjubilee

@onestacked Could you remove the TODO and fix this up so it can be merged after the other PR lands? We usually just tag PRs as S-blocked to indicate they shouldn't be merged. You might have to fix it up for merge conflicts anyways.

@onestacked
Copy link
Contributor Author

@workingjubilee I'll wait until the FCP is done, to avoid having to rebase again and again.

@RalfJung
Copy link
Member

If you want you can include stabilizing #111774 in this PR as well, as it depends on the feature here and the two went into FCP together. Given the amount of feature gates moving towards stabilization, there's no reason to have an individual PR for each of them. :)

@onestacked onestacked changed the title Stabilize const_slice_split_at_mut Stabilize const_slice_split_at_mut and slice_first_last_chunk Sep 29, 2024
@onestacked onestacked changed the title Stabilize const_slice_split_at_mut and slice_first_last_chunk Stabilize const_slice_split_at_mut and const_slice_first_last_chunk Sep 29, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@onestacked onestacked marked this pull request as ready for review September 29, 2024 22:09
@workingjubilee
Copy link
Member

Thank you!

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Oct 5, 2024

☔ The latest upstream changes (presumably #131269) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member

RalfJung commented Oct 5, 2024

Both FCPs have passed, so this is ready to go.

@onestacked can you resolve the conflicts?

@RalfJung
Copy link
Member

RalfJung commented Oct 5, 2024

r=me when CI is green.

@bors delegate+

@bors
Copy link
Contributor

bors commented Oct 5, 2024

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

If @RalfJung told you to "r=me" after making some further change, please make that change, then do @bors r=@RalfJung

@onestacked
Copy link
Contributor Author

CI passed.
@bors r=@RalfJung

@bors
Copy link
Contributor

bors commented Oct 5, 2024

📌 Commit d0e6758 has been approved by RalfJung

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 Oct 5, 2024
@RalfJung
Copy link
Member

RalfJung commented Oct 5, 2024

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#130428 (Stabilize `const_slice_split_at_mut` and `const_slice_first_last_chunk`)
 - rust-lang#131094 (std: replace `LazyBox` with `OnceBox`)
 - rust-lang#131256 (move f16/f128 const fn under f16/f128 feature gate)
 - rust-lang#131278 (remove outdated contribution direction)
 - rust-lang#131286 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 386a0ba into rust-lang:master Oct 5, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2024
Rollup merge of rust-lang#130428 - ink-feather-org:stabilize-const-split-at-mut, r=RalfJung

Stabilize `const_slice_split_at_mut` and `const_slice_first_last_chunk`

Stabilizes rust-lang#101804 and the remainder of rust-lang#111774.

FCP proposed in the tracking issue.

Requires rust-lang#130403 (or it would need a rustc_allow_const_fn_unstable for it)

Stabilized const API:
```rust
// slice
impl [T] {
    pub const fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_unchecked(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut [T], &mut [T])>;

    pub const fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn split_first_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
    pub const fn split_last_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
}
```

Closes rust-lang#101804
Closes rust-lang#111774

cc `@RalfJung`
@onestacked onestacked deleted the stabilize-const-split-at-mut branch October 5, 2024 15:06
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. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
6 participants