bumpalo icon indicating copy to clipboard operation
bumpalo copied to clipboard

Implement `Allocator` for `Bump`, not `&Bump`

Open fitzgen opened this issue 10 months ago • 2 comments

Bump does not implement Allocator but &Bump does. So to get a &dyn Allocator you'd have to take a reference to the reference:

&&bump_arena as &dyn Allocator

That being said, I think the impl Allocator for &Bump could be changed to impl Allocator for Bump so you wouldn't have that double indirection.

Originally posted by @bluurryy in #280

fitzgen avatar Jun 24 '25 15:06 fitzgen

I don't think this would be a breaking change. How is it breaking?

EDIT: since there is a blanket impl Allocator for all &T where T: Allocator

bluurryy avatar Jun 24 '25 15:06 bluurryy

EDIT: since there is a blanket impl Allocator for all &T where T: Allocator

Yep. Although maybe removing the explicit import for &Bump and allowing the blanket impl to fill that in means this wouldn't be a breaking change. Not totally sure.

fitzgen avatar Jun 24 '25 15:06 fitzgen