fix(test): pointer identity for a 'static name is not assertable on MSVC - #8239
Conversation
`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.
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
windows-buildis red on main (green 08-14 and 08-15, red 08-16). It fails the wholetest.ymlrun — and a successfultest.ymlon the tip SHA is exactly whatrelease-packages'await-testsrequires before it will cut a tag. So this blocks the release.The failure
Two tests from #8177 fail on Windows and only on Windows:
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
expectedto come from the lookup under test — and these call sites do exactly that. The remaining difference is between two'staticcopies, 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:
Windows keeps that coverage; it just cannot use address equality as the proxy.
Validation
expected(the crate is built-D warnings).windows-buildsucceeded on the 08-14 and 08-15 main runs and the test file arrived in that window via fix(runtime): bind a 'static method name on the timer and TextDecoder/TextEncoder handle paths (#8133) #8177.