Skip to content

fix Zip unsoundness (again) #141076

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

the8472
Copy link
Member

@the8472 the8472 commented May 16, 2025

Some history: The Zip TrustedRandomAccess specialization has tried to emulate the side-effects of the naive implementation for a long time, including backwards iteration. #82292 tried to fix unsoundness (#82291) in that side-effect-preservation code, but this introduced some panic-safety unsoundness (#86443), but the fix #86452 didn't fix it for nested Zip iterators (#137255).

Rather than piling yet another fix ontop of this heap of fixes this PR reduces the number of cases in which side-effects will be preserved; the necessary API guarantee change was approved in #83791 but we haven't made use of that so far.

fixes #137255

@rustbot
Copy link
Collaborator

rustbot commented May 16, 2025

r? @workingjubilee

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

@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 May 16, 2025
@the8472
Copy link
Member Author

the8472 commented May 16, 2025

CC @steffahn

@rust-log-analyzer

This comment has been minimized.

Some history: The Zip TrustedRandomAccess specialization has tried
to emulate the side-effects of the naive implementation for a long time,
including backwards iteration. rust-lang#82292 tried to fix unsoundness (rust-lang#82291) in that
side-effect-preservation code, but this introduced some panic-safety
unsoundness (rust-lang#86443), but the fix rust-lang#86452 didn't fix it for nested Zip
iterators (rust-lang#137255).

Rather than piling yet another fix ontop of this heap of fixes this PR reduces
the number of cases in which side-effects will be preserved; the necessary
API guarantee change was approved in rust-lang#83791 but we haven't made use of that
so far.
@the8472 the8472 force-pushed the fix-zip-panic-safety2 branch from 1f7a9f5 to 41aca57 Compare May 16, 2025 12:20
@workingjubilee
Copy link
Member

exciting!

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.

Panic-safety issue with Zip specializations
4 participants