Skip to content

Add support for bumpalo #231

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

Merged
merged 2 commits into from
Jan 27, 2021
Merged

Add support for bumpalo #231

merged 2 commits into from
Jan 27, 2021

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Jan 21, 2021

Allows Bump and &Bump to be used as allocators without the nightly feature.

This is currently blocked on fitzgen/bumpalo#92 for support on nightly.

src/raw/alloc.rs Outdated

#[cfg(feature = "bumpalo")]
unsafe impl Allocator for bumpalo::Bump {
fn allocate(&self, layout: Layout) -> Result<NonNull<u8>, AllocError> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, I'm comparing this with the implementation I made upstream, and the signature looks wrong.
allocator_api signature should be NonNull<[u8]>. That makes me require the nonnull_slice_from_raw_parts feature.

It feels like I'm missing something here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just an internal Allocator trait, it is completely private and can't be implemented outside this crate. As such, it doesn't have to match the standard library Allocator trait.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha! I missed that, thank you!

@Amanieu
Copy link
Member Author

Amanieu commented Jan 26, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jan 26, 2021

📌 Commit 5467e3f has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Jan 26, 2021

⌛ Testing commit 5467e3f with merge 3fcb5fd...

@bors
Copy link
Contributor

bors commented Jan 27, 2021

☀️ Test successful - checks-travis
Approved by: Amanieu
Pushing 3fcb5fd to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants