Skip to content

Use ordering equivalence for map subscripting - #544

Merged
nunoplopes merged 2 commits into
masterfrom
perfloop-pr-open-f4r6qa9tjz
Oct 19, 2026
Merged

nunoplopes merged 2 commits into
masterfrom
perfloop-pr-open-f4r6qa9tjz

Conversation

@perfloop

@perfloop perfloop Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

C++ map membership follows ordering equivalence, not operator==. When those comparisons group keys differently, translated subscripting can return another value or replace an existing entry. Both generated map implementations now use the ordering relation for the hit test; explicit equality and lazy default construction are unchanged.

tests/unit/map_key_identity.cpp exercises both mismatches and matching keys. It checks values, size and traversal, construction count, and saved iterator and value-pointer identity. It also checks that explicit key equality keeps its C++ result. The fixture was not present at the accepted base; it fails on the test-only revision and passes after the shim change.

This condition holds with this change and does not hold at 24fc5a4f9d6a1f0f9af4cc1226c52e6953a16180: For the native and default-refcount translated executions of tests/unit/map_key_identity.cpp, std::map::operator[] uses key-order equivalence for this strict-weak-order comparator, creating one mapped value per ordered identity with stable saved iterators and value pointers while preserving the explicit C++ operator== results..

The checked-in C++ fixture and generated Rust expectations ship with this change. The native-versus-translated assertion runner and pinned Cargo locks are comparison support and are not part of the pull request. The unit, UB, and multi-file tests pass with the repository's existing expected-failure cases.


Generated by Perfloop.

Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
@nunoplopes
nunoplopes merged commit 0a50394 into master Oct 19, 2026
9 checks passed
@nunoplopes
nunoplopes deleted the perfloop-pr-open-f4r6qa9tjz branch October 19, 2026 13: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.

2 participants