Skip to content

fix(test): pointer identity for a 'static name is not assertable on MSVC - #8239

Merged
proggeramlug merged 2 commits into
mainfrom
fix/windows-static-literal-pointer-identity
Aug 16, 2026
Merged

fix(test): pointer identity for a 'static name is not assertable on MSVC#8239
proggeramlug merged 2 commits into
mainfrom
fix/windows-static-literal-pointer-identity

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

windows-build is red on main (green 08-14 and 08-15, red 08-16). It fails the whole test.yml run — and a successful test.yml on the tip SHA is exactly what release-packages' await-tests requires before it will cut a tag. So this blocks the release.

The failure

Two tests from #8177 fail on Windows and only on Windows:

a_bound_text_decoder_decode_never_captures_the_key_strings_interior
a_bound_text_encoder_method_never_captures_the_key_strings_interior

assertion `left == right` failed: the closure must capture the 'static literal
  left: 0x7ff6e735e903   right: 0x7ff6e71fc973

Why it is not a runtime bug

Both failing pairs differ by the same constant offset (0x161F90) — two whole copies of the same read-only data, not a heap pointer.

ELF (SHF_MERGE|SHF_STRINGS) and Mach-O (__TEXT,__cstring) merge identical read-only strings, so the copy the closure captures and the copy the lookup returns land at one address and identity holds. MSVC does not pool identical literals across codegen units, so they stay distinct. Both are 'static.

The test's own doc comment already names this hazard for locally-written literals and requires expected to come from the lookup under test — and these call sites do exactly that. The remaining difference is between two 'static copies, which no sourcing discipline can collapse on a linker that does not merge them.

Fix

Gate the address assertion on a linker that merges. Everything substantive stays unconditional:

  • the captured name is not the movable key string's interior — the invariant the test exists for
  • the captured length matches
  • the captured bytes match

Windows keeps that coverage; it just cannot use address equality as the proxy.

Validation

Ralph Küpper added 2 commits August 16, 2026 19:55
`windows-build` is red on main — green on 08-14 and 08-15, red on 08-16 — and
it fails the whole `test.yml` run, which is what `release-packages`'
`await-tests` requires to be green before it will cut a tag.

Two tests from #8177 fail there and only there:

    a_bound_text_decoder_decode_never_captures_the_key_strings_interior
    a_bound_text_encoder_method_never_captures_the_key_strings_interior
    assertion `left == right` failed: the closure must capture the 'static literal
      left: 0x7ff6e735e903   right: 0x7ff6e71fc973

Both pairs differ by the SAME constant offset (0x161F90) — two whole copies of
the same read-only data, not a heap pointer. ELF (`SHF_MERGE|SHF_STRINGS`) and
Mach-O (`__TEXT,__cstring`) merge identical read-only strings, so the copy the
closure captures and the copy the lookup returns land at one address and
identity holds. MSVC does not pool identical literals across codegen units, so
they stay distinct. Both are `'static`.

The test's own doc comment already names this hazard for locally-written
literals and requires `expected` to come from the lookup under test. These call
sites do exactly that; the remaining difference is between two `'static` copies,
which no amount of sourcing discipline can collapse on a linker that does not
merge them.

So gate the ADDRESS assertion on a linker that merges. The property the test
exists for — the captured name must not be the MOVABLE key string's interior —
is asserted unconditionally, as are the captured length and the captured bytes.
Windows keeps that coverage; it just cannot use address equality as the proxy.

Verified both arms: with the assertion compiled out the crate builds warning
clean (no unused `expected`), and on macOS all 6 tests in the module pass.
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@proggeramlug, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Limit details: You’ve used all 8 included reviews currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 607a70bb-d377-46ae-a7e7-69dd367c6d9c

📥 Commits

Reviewing files that changed from the base of the PR and between 537f74a and a86c367.

📒 Files selected for processing (2)
  • changelog.d/8239-windows-static-literal-identity.md
  • crates/perry-runtime/src/gc/tests/handle_bound_method_name.rs
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-static-literal-pointer-identity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit 352cc18 into main Aug 16, 2026
4 of 18 checks passed
@proggeramlug
proggeramlug deleted the fix/windows-static-literal-pointer-identity branch August 16, 2026 18:00
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