Skip to content

Allocator update for use with GlobalAlloc feature #1

Closed
@willscott

Description

@willscott

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions