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
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
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

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants