[5.1][stdlib] RawRepresentable: revert to default _rawHashValue(seed:) #25928
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.
Cherry-picked from #25873
Explanation: In 5.0, RawRepresentable types aren't able to customize their hashing by implementing the usual
hash(into:)
method. This resolves this issue, allowing RawRepresentable types to have control over their hashing as long as they are running on the 5.1+ stdlib.Scope: Changes the default behavior of hashing on RawRepresentable types so that custom
hash(into:)
implementations aren't being ignored.Issue: https://bugs.swift.org/browse/SR-10734 / rdar://problem/51319164
Risk: Medium. When running on the 5.0 stdlib, a
hash(into:)
implementation in a type that conforms to RawRepresentable has no effect; in 5.1+, such implementation will have the expected effect of customizing hashing. This is a subtle change in behavior that in rare circumstances can cause backward/forward deployment issues (like any other bug fix that we cannot emit into the client).Testing: Regression test suite, including a new test added specifically for this issue.
Reviewer: @jrose-apple