Repository navigation
Use ordering equivalence for map subscripting - #544
Merged
Merged
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.cppexercises 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.