Skip to content

core: drop unmapped ZSTs in array map#152487

Open
joboet wants to merge 1 commit intorust-lang:mainfrom
joboet:array_map_zst
Open

core: drop unmapped ZSTs in array map#152487
joboet wants to merge 1 commit intorust-lang:mainfrom
joboet:array_map_zst

Conversation

@joboet
Copy link
Copy Markdown
Member

@joboet joboet commented Feb 11, 2026

Fixes #152211.
Alternative to #152220 and #152248.

This makes the Drain type use the same ZST-handling strategy as slice::IterMut, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic N parameter from Drain to avoid unnecessary monomorphizations.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 11, 2026
@joboet joboet marked this pull request as ready for review February 11, 2026 14:30
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 11, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 11, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 11, 2026

r? @scottmcm

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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, scottmcm

@scottmcm
Copy link
Copy Markdown
Member

I'll flip this to the same reviewer as #147071
r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned scottmcm Apr 18, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 18, 2026

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

Copy link
Copy Markdown
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

📌 Commit b9ad3a9 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Apr 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 27, 2026
core: drop unmapped ZSTs in array `map`

Fixes rust-lang#152211.
Alternative to rust-lang#152220 and rust-lang#152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 27, 2026
core: drop unmapped ZSTs in array `map`

Fixes rust-lang#152211.
Alternative to rust-lang#152220 and rust-lang#152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
rust-bors Bot pushed a commit that referenced this pull request Apr 27, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #152487 (core: drop unmapped ZSTs in array `map`)
 - #155716 (arm64e: set ptrauth ABI subtype on lib.rmeta Mach-O objects)
 - #155864 (Fix panic for doc attributes on where predicates)
 - #155865 (add test for accidentally fixed `binius_field` issue)
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

⌛ Testing commit b9ad3a9 with merge 44ae6c2...

Workflow: https://github.com/rust-lang/rust/actions/runs/24994532499

rust-bors Bot pushed a commit that referenced this pull request Apr 27, 2026
core: drop unmapped ZSTs in array `map`

Fixes #152211.
Alternative to #152220 and #152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors r-
#155872 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 27, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 27, 2026

This pull request was unapproved.

This PR was contained in a rollup (#155872), which was unapproved.

Auto build was cancelled due to unapproval. Cancelled workflows:

View changes since this unapproval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

array::map and array::try_map do not drop ZSTs properly

5 participants