Skip to content

Add offset slice views and split_first_mut#153

Draft
coord-e wants to merge 4 commits into
mainfrom
codex/slices-offset
Draft

Add offset slice views and split_first_mut#153
coord-e wants to merge 4 commits into
mainfrom
codex/slices-offset

Conversation

@coord-e

@coord-e coord-e commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • extend Seq with an offset field
  • add offset-aware subsequence support without prepend
  • update Vec and slice specs and their tests for the three-field Seq representation
  • add a split_first_mut extern spec using Mut::new and subsequence
  • add paired pass/fail tests

Design

The offset lets multiple slice views share one underlying array while changing their logical start and length. subsequence(start, end) preserves the array, advances the offset by start, and sets the view length to end - start.

Known limitation

The current handling of mutable references returned inside tuples can make mutation propagation through split_first_mut unsound. This is accepted for this PR and documented in the related discussion on #124: #124 (comment)

Validation

  • cargo check
  • compiler-backed slice-index reconstruction unit tests
  • all slice and split_first_mut pass/fail pairs with the default Spacer solver
  • subsequence and loop-invariant pass/fail pairs with PCSAT

@coord-e coord-e force-pushed the codex/slices-basic branch 4 times, most recently from 74906dd to 4e5abf2 Compare June 28, 2026 14:56
Base automatically changed from codex/slices-basic to main June 28, 2026 14:58
@coord-e coord-e force-pushed the codex/slices-offset branch from 0227165 to 6dcd001 Compare June 28, 2026 15:04
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.

1 participant