Skip to content

Harden Large allocation layout invariants#18

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/review-internal-implementation
Draft

Harden Large allocation layout invariants#18
Copilot wants to merge 5 commits intomasterfrom
copilot/review-internal-implementation

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 15, 2026

The internal Large allocation logic relies on precise layout and pointer offset invariants for soundness. This update tightens layout construction and validates header/data offsets across alignments.

  • Layout construction
    • Use Layout::extend/pad_to_align to compute heap layouts directly from header + element layout.
  • Pointer provenance
    • Derive data_start from the header size and document the invariant.
  • Coverage
    • Add layout/data-start assertions across multiple element alignments with guarded deallocation.

Example:

let header = Layout::new::<Allocated<T>>();
let data = Layout::array::<T>(cap).expect("new capacity is too large");
let (layout, offset) = header.extend(data).expect("new capacity is too large");
debug_assert_eq!(offset, size_of::<Allocated<T>>());
layout.pad_to_align()

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 15, 2026 07:54
Co-authored-by: SOF3 <19623715+SOF3@users.noreply.github.com>
Co-authored-by: SOF3 <19623715+SOF3@users.noreply.github.com>
Co-authored-by: SOF3 <19623715+SOF3@users.noreply.github.com>
Co-authored-by: SOF3 <19623715+SOF3@users.noreply.github.com>
Copilot AI changed the title [WIP] Review soundness of internal implementation Harden Large allocation layout invariants Feb 15, 2026
Copilot AI requested a review from SOF3 February 15, 2026 08:01
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.

2 participants