Skip to content

Remove [T]::array_chunks(_mut) - #143289

Merged
bors merged 1 commit into
rust-lang:masterfrom
scottmcm:remove-array-chunks
Jul 29, 2025
Merged

Remove [T]::array_chunks(_mut)#143289
bors merged 1 commit into
rust-lang:masterfrom
scottmcm:remove-array-chunks

Conversation

@scottmcm

@scottmcmscottmcm commented Jul 1, 2025

Copy link
Copy Markdown
Member

Since libs-api is proposing as much in #74985 (comment)

Closes#74985
Closes#76354

try-job: dist-various-1
try-job: dist-various-2

@rustbot

Copy link
Copy Markdown
Collaborator

r? @jhpratt

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

@rustbotrustbot 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 Jul 1, 2025
@scottmcmscottmcm added the S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. label Jul 1, 2025
@scottmcmscottmcm mentioned this pull request Jul 1, 2025
7 tasks
@scottmcmscottmcm removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2025
Comment on lines 790 to 798
pub fn from_utf16le(v: &[u8]) -> Result<String, FromUtf16Error> {
if v.len() % 2 != 0 {
let (chunks, []) = v.as_chunks::<2>() else {
return Err(FromUtf16Error(()));
}
};
match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
(true, ([], v, [])) => Self::from_utf16(v),
_ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes))
_ => char::decode_utf16(chunks.iter().copied().map(u16::from_le_bytes))
.collect::<Result<_, _>>()
.map_err(|_| FromUtf16Error(())),
}

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Hooray for let-else and slice patterns meaning this can write "the chunks with no tail", rather than needing to have an explicit % 2.

@dtolnaydtolnay added T-libs-api [DEPRECATED; DO NOT USE] and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 1, 2025
@rust-log-analyzer

This comment has been minimized.

@Amanieu

Copy link
Copy Markdown
Member

From #74985 (comment):

We discussed this again the @rust-lang/libs-api meeting and concluded that there is little use for an array_chunks iterator when we already have as_chunks. As such we would like to remove this unstable API.

@rfcbot merge

@rfcbot

rfcbot commented Jul 1, 2025

Copy link
Copy Markdown

Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbotrfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 1, 2025
@jhpratt

Copy link
Copy Markdown
Member

Let me know when CI is passing an I can take a look.

@scottmcm
scottmcmforce-pushed the remove-array-chunks branch from 9c9725c to 4814b93CompareJuly 2, 2025 02:52
@rust-log-analyzer

This comment has been minimized.

@scottmcm
scottmcmforce-pushed the remove-array-chunks branch from 4814b93 to bc6d1c2CompareJuly 2, 2025 03:25
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

#![cfg_attr(test, feature(cfg_select))]
#![feature(alloc_layout_extra)]
#![feature(array_chunks)]
#![feature(array_ptr_get)]

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Achievement Acquired: first CI failure from a .patch file.

@scottmcm

Copy link
Copy Markdown
MemberAuthor

@jhpratt This is passing CI now, if you want to take a look, but no rush since it can't land in less than 10 days anyway.

@jhpratt

Copy link
Copy Markdown
Member

LGTM! r=me if/when FCP is complete.

@scottmcm

Copy link
Copy Markdown
MemberAuthor

Friendly reminder for the p-FCP here (#143289 (comment)), @joshtriplett@m-ou-se@BurntSushi

@rfcbotrfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jul 17, 2025
@rfcbot

Copy link
Copy Markdown

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbotrfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jul 27, 2025
@rfcbot

Copy link
Copy Markdown

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@borsbors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 27, 2025
@scottmcm
scottmcmforce-pushed the remove-array-chunks branch from bc6d1c2 to 84919a4CompareJuly 28, 2025 05:58
@rustbot

This comment has been minimized.

@scottmcm
scottmcmforce-pushed the remove-array-chunks branch from 84919a4 to 173926dCompareJuly 28, 2025 06:04
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Trying the weird platforms that failed in the rollup...
@bors try

@rust-bors

rust-borsBot commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

⌛ Trying commit 173926d with merge 653efc4

To cancel the try build, run the command @bors try cancel.

rust-borsBot added a commit that referenced this pull request Jul 28, 2025
Remove `[T]::array_chunks(_mut)`
try-job: dist-various-1
try-job: dist-various-2
@rust-bors

rust-borsBot commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 653efc4 (653efc42453b365d6cb04f21b38f4017de2dc3fa, parent: 733dab558992d902d6d17576de1da768094e2cf3)

@scottmcm

Copy link
Copy Markdown
MemberAuthor

Well the job that failed in the rollup passed, so let's give it another shot
@bors r=jhpratt rollup=maybe (failed before in platform-specific library code)

@bors

bors commented Jul 28, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 173926d has been approved by jhpratt

It is now in the queue for this repository.

@borsbors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 28, 2025
samueltardieu added a commit to samueltardieu/rust that referenced this pull request Jul 28, 2025
…pratt
Remove `[T]::array_chunks(_mut)`
Since libs-api is proposing as much in rust-lang#74985 (comment)Closesrust-lang#74985Closesrust-lang#76354
try-job: dist-various-1
try-job: dist-various-2
bors added a commit that referenced this pull request Jul 29, 2025
Rollup of 11 pull requests
Successful merges:
- #143289 (Remove `[T]::array_chunks(_mut)`)
- #143883 (Add `--link-targets-dir` argument to linkchecker)
- #144034 (tests: Test line number in debuginfo for diverging function calls)
- #144236 (Add `core::mem::DropGuard`)
- #144268 (Add method `find_ancestor_not_from_macro` and `find_ancestor_not_from_extern_macro` to supersede `find_oldest_ancestor_in_same_ctxt`)
- #144303 (Consolidate staging for `rustc_private` tools)
- #144539 (constify with_exposed_provenance)
- #144569 (rustc-dev-guide subtree update)
- #144573 (Raw Pointers are Constant PatKinds too)
- #144578 (Ensure correct aligement of rustc_hir::Lifetime on platforms with lower default alignments.)
- #144582 (fix `Atomic*::as_ptr` wording)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors

bors commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 173926d with merge cb6785f...

@bors

bors commented Jul 29, 2025

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: jhpratt
Pushing cb6785f to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 29, 2025
@bors
bors merged commit cb6785f into rust-lang:masterJul 29, 2025
12 checks passed
@rustbotrustbot added this to the 1.90.0 milestone Jul 29, 2025
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing cdccba8 (parent) -> cb6785f (this PR)

Test differences

Show 347 test diffs

Stage 1

  • slice::test_array_chunks_count: pass -> [missing] (J0)
  • slice::test_array_chunks_infer: pass -> [missing] (J0)
  • slice::test_array_chunks_last: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_count: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_infer: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_last: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_nth: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_nth_back: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_remainder: pass -> [missing] (J0)
  • slice::test_array_chunks_mut_zip: pass -> [missing] (J0)
  • slice::test_array_chunks_nth: pass -> [missing] (J0)
  • slice::test_array_chunks_nth_back: pass -> [missing] (J0)
  • slice::test_array_chunks_remainder: pass -> [missing] (J0)
  • slice::test_array_chunks_zip: pass -> [missing] (J0)

Additionally, 333 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard cb6785f73df1aa3f558796a22a4ab9652cf38e26 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-apple: 5347.9s -> 9929.5s (85.7%)
  2. dist-powerpc64-linux: 8091.2s -> 5215.4s (-35.5%)
  3. x86_64-apple-2: 6410.1s -> 4707.0s (-26.6%)
  4. dist-aarch64-linux: 8121.4s -> 5994.6s (-26.2%)
  5. dist-x86_64-apple: 8685.0s -> 9855.1s (13.5%)
  6. x86_64-apple-1: 8932.5s -> 8218.8s (-8.0%)
  7. dist-apple-various: 7454.4s -> 8029.6s (7.7%)
  8. x86_64-gnu-llvm-19-2: 5781.0s -> 6212.3s (7.5%)
  9. x86_64-msvc-ext1: 6971.5s -> 7398.4s (6.1%)
  10. x86_64-gnu-llvm-19-1: 3396.6s -> 3603.3s (6.1%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@scottmcm
scottmcm deleted the remove-array-chunks branch July 29, 2025 06:00
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (cb6785f): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
1.4%[1.4%, 1.4%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-2.3%[-2.3%, -2.3%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.5%[-2.3%, 1.4%]2

Cycles

Results (secondary -3.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-3.7%[-4.8%, -2.7%]2
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 469.046s -> 467.912s (-0.24%)
Artifact size: 376.81 MiB -> 376.82 MiB (0.00%)

github-actionsBot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jul 30, 2025
Remove `[T]::array_chunks(_mut)`
Since libs-api is proposing as much in rust-lang#74985 (comment)Closesrust-lang#74985Closesrust-lang#76354
try-job: dist-various-1
try-job: dist-various-2
@apirainoapiraino removed the to-announce Announce this issue on triage meeting label Aug 28, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-libs-api[DEPRECATED; DO NOT USE]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does [T]::array_chunks really need to be an iterator? Tracking Issue for slice::array_chunks

11 participants

@scottmcm@rustbot@rust-log-analyzer@Amanieu@rfcbot@jhpratt@bors@matthiaskrgr@rust-timer@dtolnay@apiraino