Skip to content

Fix TrailingSliceLayout and remove Split::via_unaligned - #3778

Closed
joshlf wants to merge 1 commit into
mainfrom
Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i
Closed

joshlf wants to merge 1 commit into
mainfrom
Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i

Conversation

@joshlf

@joshlf joshlf commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Represent slice-DST sizes as C + round_up(r + nE, A), encoding A and r in one nonzero word. Carry that four-word layout formula through composition, padding, metadata inference, casts, projections, allocation, and split overlap checks.

This is a smaller state-model alternative to #3630. Exhaustive reduced-width model checking matches #3630's core formula transforms and representability behavior, and the checked benchmark snapshots are byte-for-byte identical.

Add regression coverage for compiler-accepted generic packed/aligned nesting, parsing, allocation, zeroing, projection, metadata plateaus, and dynamic padding. Add modular Kani proofs for the normal form, transforms, inverse validator, affine cast arithmetic, alignment, containment, the conservative dynamic-padding predicate, and both modern and MSRV unchecked-arithmetic implementations. The arithmetic proofs are conditional on the documented compiler-layout premise; regression and Miri coverage exercise the actual compiler layout and pointer paths.

Closes #3617

Authored by an AI agent acting on Josh Liebow-Feeser's and Jack Wrenn's behalf.

Agent-authored-by: AI agent acting on joshlf's behalf (content only)


Latest Update: v2 — Compare vs v1

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v1 Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i && git checkout -b pr-Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i FETCH_HEAD

Checkout

git fetch origin refs/heads/Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i

Stacked PRs enabled by GHerrit.

Represent slice-DST sizes as C + round_up(r + nE, A), encoding A and r in one nonzero word. Carry that four-word layout formula through composition, padding, metadata inference, casts, projections, allocation, and split overlap checks.

This is a smaller state-model alternative to #3630. Exhaustive reduced-width model checking matches #3630's core formula transforms and representability behavior, and the checked benchmark snapshots are byte-for-byte identical.

Add regression coverage for compiler-accepted generic packed/aligned nesting, parsing, allocation, zeroing, projection, metadata plateaus, and dynamic padding. Add modular Kani proofs for the normal form, transforms, inverse validator, affine cast arithmetic, alignment, containment, the conservative dynamic-padding predicate, and both modern and MSRV unchecked-arithmetic implementations. The arithmetic proofs are conditional on the documented compiler-layout premise; regression and Miri coverage exercise the actual compiler layout and pointer paths.

Closes #3617

*Authored by an AI agent acting on Josh Liebow-Feeser's and Jack Wrenn's behalf.*

gherrit-pr-id: Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i
Agent-authored-by: AI agent acting on joshlf's behalf (content only)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T21:18:38.745379Z 86b2094 PR opened
🔒 Security Review ✅ Completed 2026-10-05T21:21:38.529002Z 86b2094 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86b2094a28

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,22 @@
#[allow(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required copyright header to the new snapshot

This newly added .expected.rs file starts directly with generated tokens and therefore omits the required repository copyright header and creation year. Add the 2026 header and ensure the ZEROCOPY_BLESS path preserves it when regenerating snapshots.

AGENTS.md reference: zerocopy/AGENTS.md:L35-L36

Useful? React with 👍 / 👎.

@codecov-commenter

codecov-commenter commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.36170% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.94%. Comparing base (28f6b0f) to head (7c8ecd9).

Files with missing lines Patch % Lines
zerocopy/src/split_at.rs 89.13% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3778      +/-   ##
==========================================
- Coverage   93.16%   92.94%   -0.22%     
==========================================
  Files          16       16              
  Lines        2413     2466      +53     
==========================================
+ Hits         2248     2292      +44     
- Misses        165      174       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf
joshlf force-pushed the Ge2cllcsxpw6mt6keaxk2hu3vg67rdk6i branch from 86b2094 to 7c8ecd9 Compare October 5, 2026 21:44
@joshlf joshlf closed this Oct 5, 2026
auto-merge was automatically disabled October 5, 2026 22:09

Pull request was closed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security Advisory: Nested packed DST layouts underallocate memory and permit out-of-bounds access

2 participants