Skip to content

Implement pick[23]_mut via get_disjoint_mut [rustc cleanup] #138196

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

Closed
scottmcm opened this issue Mar 8, 2025 · 1 comment · Fixed by #138372
Closed

Implement pick[23]_mut via get_disjoint_mut [rustc cleanup] #138196

scottmcm opened this issue Mar 8, 2025 · 1 comment · Fixed by #138372
Assignees
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@scottmcm
Copy link
Member

scottmcm commented Mar 8, 2025

The IndexSlice internal type has two methods

that offer a safe interface to getting multiple mutable borrows into the slice.

Now that https://doc.rust-lang.org/beta/std/primitive.slice.html#method.get_disjoint_mut exists, their current non-trivial implementations can be replaced with a call to that stabilized method (and some pattern-matching and unwrapping).

It's probably not worth changing all the code to stop using pick[23]_mut; just swapping out the implementation is enough.

@scottmcm scottmcm added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Mar 8, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 8, 2025
@jieyouxu jieyouxu added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 8, 2025
@Eclips4
Copy link
Contributor

Eclips4 commented Mar 11, 2025

@rustbot claim

jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 12, 2025
Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`

Closes rust-lang#138196
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 12, 2025
Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`

Closes rust-lang#138196
@bors bors closed this as completed in 2bdb10f Mar 12, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 12, 2025
Rollup merge of rust-lang#138372 - Eclips4:issue-138196, r=scottmcm

Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`

Closes rust-lang#138196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants