Workaround rust compiler goof in Policy::translate_pk #234
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.
These previously untested methods result in a compiler error if you ever tried to call them. This happens because if you put &mut in front of the type when you recursively pass it to another call you are actually creating a &mut &mut since the argument may already be a &mut. This ends up in infinite &muts prefix. The compiler only figures this out when you call the method (not at compile time of the library).
I fixed this by having an inner function take a &mut FnMut as the argument and so breaking the chain of &mut. The public functions remains the same. There might be a better way to fix this but I tried for more than an hour to do this without an inner and outer function and nothing else worked.