Skip to content

Question: Is it okay for Bump::grow to only receive a new_size, but not the entire new_layout? #143

@yanchith

Description

@yanchith

Was doing some relaxing reading of bumpalo's source (commit b22416c) when I found the following:

Allocator::grow receives new_layout, but the Allocator trait impl in bumpalo only passes new_size to Bump::grow.

What happens, if Allocator::grow gets called with a new layout that has a greater alignment requirement? Docs of Allocator::grow say:

Returns Err if the new layout does not meet the allocator’s size and alignment constraints of the allocator, or if growing otherwise fails.

So I guess it would be ok to return AllocError if the alignment requirements got stricter with the new layout, but the trait impl currently ignores that.

I also could be missing something 😂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions