rust-embedded/embedded-alloc

Possible Broken Dependency: linked_list_allocator

avlec opened this issue · 0 comments

avlec commented

Trying to build on OSx 10.15.3. With the following Rust & Cargo versions.

master* ❯ rustc --version                                                                                                                                                                                                12:12:47
rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
master* ❯ cargo --version                                                                                                                                                                                                12:17:34
cargo 1.43.0-nightly (bda50510d 2020-03-02)

The following error occurs when trying to envoke cargo build.

error[E0053]: method `alloc` has an incompatible type for trait
   --> /Users/avlec/.cargo/registry/src/github.com-1ecc6299db9ec823/linked_list_allocator-0.6.6/src/lib.rs:133:5
    |
133 |     unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
    |
    = note: expected fn pointer `fn(&mut Heap, core::alloc::Layout) -> core::result::Result<(core::ptr::NonNull<u8>, usize), _>`
               found fn pointer `unsafe fn(&mut Heap, core::alloc::Layout) -> core::result::Result<core::ptr::NonNull<u8>, _>`

This is verified an issue with the version of linked_list_allocator, as building with the same environment on 0.6.6 yields the same error. It is to note that this error is from just building linked_list_allocator independently from alloc-cortex-m.

~/Downloads/linked-list-allocator-0b7fdddd067448327a3f6ad9d2b39045a2b3f922 ❯ cargo build                                                                                                                                             13:51:13
    Updating crates.io index
  Downloaded spin v0.5.2
   Compiling spin v0.5.2
   Compiling linked_list_allocator v0.6.6 (/Users/avlec/Downloads/linked-list-allocator-0b7fdddd067448327a3f6ad9d2b39045a2b3f922)
error[E0053]: method `alloc` has an incompatible type for trait
   --> src/lib.rs:133:5
    |
133 |     unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
    |
    = note: expected fn pointer `fn(&mut Heap, core::alloc::Layout) -> core::result::Result<(core::ptr::NonNull<u8>, usize), _>`
               found fn pointer `unsafe fn(&mut Heap, core::alloc::Layout) -> core::result::Result<core::ptr::NonNull<u8>, _>`

Proposed solution is to update the linked_list_allocator dependency to 0.8.0 minimum, as this is the most recent version that successfully builds.