-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RawTable allocator can't be used by stable code #226
Comments
I think the safest bet would be to add |
Several people have interest in using hashbrown with bumpalo, which was the original motivation for adding allocator support to hashbrown. Perhaps this is better exposed by adding a "bumpalo" optional feature that specifically exports a |
I've yanked 0.10.0 until this gets resolved. |
I started working on my suggestion for defaults and hidden (pub-in-private) shims. I think that may be orthogonal to adding bumpalo-specific types. |
I see that #133 tried to make
RawTable
's allocator parameter safe for stable code:However, I don't think this is sufficient as-is. There is an unfortunate side effect that crate features can be enabled indirectly, forcing the unstable feature on crates that aren't prepared for it. For instance:
indexmap
tohashbrown 0.10
with just the "raw" feature, not "nightly". I'll use the stable shim version ofhashbrown::raw::Global
, and it seems fine.hashbrown
"nightly". It should be fine if the user is opting into the nightly compiler for their project.indexmap
now fails to compile for lack of#![feature(allocator_api)]
, sinceGlobal
became the unstable type fromstd
.I think this might have been avoided if
RawTable
had a defaultA = Global
, soindexmap
wouldn't have to name it at all. It also seems problematic thatwith_capacity
needs an allocator parameter, althoughDefault::default()
seems to work ok. I would have expected it to remain without that parameter though, perhapswith_capacity_in
for that instead, likenew
/new_in
.Even with default
A = Global
, I think it's a problem thatGlobal
may or may not require#![feature(allocator_api)]
. A stable user might explicitly choose to specify the "stable"Global
, and still have the rug pulled out when "nightly" is enabled elsewhere. This is also true ofHashMap
andHashSet
which do haveA = Global
now.The text was updated successfully, but these errors were encountered: