Raising requirements to the type level is generally a good thing. But especially given that manual allocation is inherently an
unsafe operation, I'm wondering if it's a bit heavy-handed and not really necessary.
Rust does pride itself on zero-cost abstractions and pick-your-costs, but moreso than that, I think Rust also is useful because it is _safe by default_. IOW, the first API you tend to reach for should be the safest to use; for the case of allocators, that would mean requiring them to handle zero-sized allocations transparently, rather than pushing that to the user.
Going through the list of
Alloc-friends traits in alloc-wg, per that concept, the available methods that could reasonably need to handle zero-sized "allocations", or can pretend they don't exist would be:
realloc(ptr, Layout, Layout)
grow_in_place(ptr, Layout, usize)
shrink_in_place(ptr, Layout, usize)
i.e. all of them could fairly reasonably be expected to work transparently with zero sized allocations.
Might've posted this in the wrong stream :)
How did this happen :P
I am too unfamiliar with Zulip apparently...
Really, when my narrow is t-libs/wg-allocators, <kbd>New topic</kbd> really should default to being in that stream
Hi m8, great to see you again!
Yeah I don't keep up with Zulip enough
@Christopher Durham hey, do you want to push for alloc_layout_extras to be stabilized? :D
I am slowly doing that rowan refactoring, and I could use a way to allocate stuff without doing all the layout calculations wrongly myself
@matklad just use pointer-utils now that it's published :P
But yeah, alloc_layout_extras seems worth to push to stabilize
And honestly just give me an actual target of what to do and I'll probably nerd snipe myself into banging it out
I sort-of lean towards vendoring the exact combo of union of tagged DST arcs into rowan
As we maybe might want to swticht to u32 ref count without weekrefs as well
I've started https://github.com/rust-analyzer/bonsai a while back, which I think is even sort-of works, except for the bit where I need to cacl the layout :D
I'll take a look at bonsai and push for alloc_layout_extras I guess