Make the allocator_api and allocator-api2 features compatible
#286
+77
−57
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.
In some niche use cases, it seems useful for
&Bumpto implement bothcore::alloc::Allocatorandallocator-api2::alloc::Allocatorat once. This has come up for me specifically when using data structures from different crates which were generic over those differing allocator traits.However, simply enabling both the "allocator_api" and "allocator-api2" features doesn't work because there's only a single impl block that's conditionally compiled if either feature is enabled. This causes the "allocator_api" implementation to overwrite the "allocator-api2" one.
If this is intended behavior, would it be alright if I add a note to the README to that effect to help others who might be confused like I was initially? And if not, this PR just introduces two separate impl blocks so that
&Bumpcan satisfy both traits simultaneously.