Add an "allocator-api2" feature - #461
Conversation
|
CI is crying |
|
this looks good it's +500 LOC more but it's expected given the feature it's adding is it now ready for review?? |
|
I'm not sure how this will interact with your original PR on one side we have the nightly allocator API on the other side we have the allocator-api2, which is a reflection of the nightly API ported to stable this is more complex than I initially thought it to be we basically have these cases:
but since api2 is just api re-exported, this is simply a normal feature that works when enabled independently of the rust build and since api2 re-exports api, we can simply never link against the unstable allocator-api and use allocator-api2. that will also help us by removing a potential version mismatch between allocator-api2 and the current nightly implementation regarding the implementations, I think we should go dead-simple: use an allocator generic internally for let me know your opinion on this |
|
The first PR can be closed now. It was an attempt to get the "stable + no allocator" and "nightly + allocator-api" under one hood without any dependency. It worked, but it was also ugly. I've opted to create a new PR for supporting Of all the cases you've listed, "stable + no allocator" and "nightly + no allocator" should be of no concern, because the allocator type variable defaults to
Something that needs to be mentioned is that rust-lang/rust#156882 seems to landing soon (?), |
|
this is becoming insanely complicated out of all options we have, knowing what you just said that it's almost stabilizing, I'm simply say it's better to wait and implement it properly for the few versions that have it stable the nightly feature + allocator-api2 setup is just too cumbersome, and having allocator-api2 in the dependency graph certainly isn't nice, it's kind of a smell we still have a few more months to figure this out, if by the time beta.1 release date approaches (12th October) we see it better, then we implement it in alpha, otherwise we'll have it in beta we could also try to postpone a bit the releases. say, 9th November beta.1 and 15th December rc.1 or something like that |
Second attempt at creating custom allocators for
SmallVec.This one uses the
allocator-api2crate (enabled by the feature with the same name) to provide provide accessto allocators in stable Rust. If the feature is disabled, the allocator api provided by nightly Rust is used instead.
Closes #55.