Skip to content

Arena::alloc_copy_inner (at least) should be renamed and made public #18471

Closed
@comex

Description

@comex

I think this is small enough not to need a RFC.

Just as we have both box and heap::allocate, Arena has a safe method to construct an object of a fixed-size type, but should also have an unsafe method to allocate an arbitrary number of bytes. This is what alloc_copy_inner currently does (used for types without a destructor), but it is private. It should be made public (and unsafe?) and given a more descriptive name.

It would be nice to have functionality such as custom destructors and a safe way to allocate DSTs in an Arena, but those would require, respectively, some refactoring and placement new in the language. What this issue is asking for, however, is a simple change that doesn't require design work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions