[ty] Remove many PartialOrd/Ord implementations#23573
Merged
AlexWaygood merged 2 commits intomainfrom Feb 26, 2026
Merged
Conversation
4574306 to
7b24d8f
Compare
Typing conformance resultsNo changes detected ✅ |
Memory usage reportMemory usage unchanged ✅ |
|
carljm
approved these changes
Feb 26, 2026
Contributor
carljm
left a comment
There was a problem hiding this comment.
Assuming the hashset change doesn't throw up a big perf regression for some reason, this looks good to me!
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unsupported-operator |
4 | 0 | 0 |
invalid-argument-type |
2 | 1 | 0 |
unresolved-attribute |
2 | 0 | 0 |
| Total | 8 | 1 | 0 |
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.
Summary
Following the removal of the
type_orderingmodule in 09de8ef... we can remove even more code! We have manyPartialOrd/Ordimplementations for our Salsa-interned structs which are now unused. That wouldn't be too much of a problem... except that these implementations have also proved themselves to be a significant bug magnet for us, because of the fact that you cannot guarantee a stable ordering of Salsa IDs between two runs of ty. This has led to us adding big warning paragraphs in our doc-comments whenever we addPartialOrdandOrdimplementations to these structs -- but it's much less error-prone if we just don't have these methods derived in the first place!There are still a few
PartialOrdandOrdimplementations left on this PR branch, but this PR gets rid of all the ones that are easy to get rid of. It also gets rid of some on unit enums which were probably harmless, but which are also unused -- we can easily add them back if we ever need them in the future.The second commit is the only change that removes a
PartialOrd/Ordimplementation that was "used", innewtype.rs. But the only use of these implementations was so thatNewTypes could be inserted into aBTreeSetcache, and it's trivial to use anFxHashSetcache there instead -- so that's what the second commit does.Test Plan
cargo test -p ty_python_semantic