Skip to content

mark_sweep: add Gc::cast_ref_unchecked parity API and tests#70

Open
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:feat/gc-cast-ref-unchecked-parity
Open

mark_sweep: add Gc::cast_ref_unchecked parity API and tests#70
Flamki wants to merge 1 commit intoboa-dev:mainfrom
Flamki:feat/gc-cast-ref-unchecked-parity

Conversation

@Flamki
Copy link
Copy Markdown
Contributor

@Flamki Flamki commented Mar 29, 2026

Part of #63

This PR adds Gc::cast_ref_unchecked parity support for both mark-sweep collectors and covers it with focused tests.

What changed

  • Added unsafe fn Gc::cast_ref_unchecked<U>(&Gc<T>) -> &Gc<U> in:
    • mark_sweep
    • mark_sweep_arena2
  • Added tests in both collectors:
    • cast_ref_unchecked_preserves_identity_and_value

Why

cast_ref_unchecked is still listed as a parity gap in #63.
This closes that gap without touching allocator/integration architecture.

Scope

  • pointer API parity + tests only
  • no allocator policy changes
  • no collector lifecycle changes

Validation

  • cargo fmt --all -- --check
  • cargo test --workspace -q
  • cargo clippy --workspace --all-features --all-targets -q

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