Trie workaround: Avoid assertion failure for "higher" bits. #250
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.
The problematic use case for this data structure is a poor hash function with many unequal keys whose hashes are all equal for some reason.
In these cases, the data structure design assumptions get violated, but there isn't a clear place to check for this given how things are structured. It's a lot of inductive, bottom-up logic.
This PR is helping move the problem, when it arises, from some low-level assertion failure into another part of the logic. To be clear, I do not think this PR is addressing the root issue of the design or its problematic behavior that we see in CanCan today. But it's helping push the problem into a new place, in other parts of the code.