Skip to content
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

Allocator update for use with GlobalAlloc feature #1

Closed
willscott opened this issue Sep 22, 2018 · 2 comments
Closed

Allocator update for use with GlobalAlloc feature #1

willscott opened this issue Sep 22, 2018 · 2 comments

Comments

@willscott
Copy link

The rust Alloc trait is getting updated, per rust-lang/rust#49668

In particular, the u8 return types for methods like alloc are getting replaced by a new type *mut Opaque. The code in dlmalloc/mod.rs doesn't compile against this new interface, with error

error[E0053]: method `dealloc` has an incompatible type for trait
  --> libsip/src/dlmalloc/mod.rs:69:5
   |
69 |     unsafe fn dealloc(&mut self, ptr: ptr::NonNull<u8>, layout: Layout) {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected extern type `std::alloc::Opaque`, found u8
   |
   = note: expected type `unsafe fn(&mut dlmalloc::Dlmalloc, std::ptr::NonNull<std::alloc::Opaque>, std::alloc::Layout)`
              found type `unsafe fn(&mut dlmalloc::Dlmalloc, std::ptr::NonNull<u8>, std::alloc::Layout)

Context: The use of global_allocator triggers rust to ask for the global_allocator feature to be added to the crate in current nightlies, which cascades to changing the Alloc trait.

@lachlansneff
Copy link
Contributor

Oh no, not again! It's probably a good idea to get rid of the global allocator stuff in this crate and let rust handle it.

@willscott
Copy link
Author

This was caused because of an out-of-date rust compiler version, not a libsip problem

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

No branches or pull requests

2 participants