Open qdwang opened 6 years ago
Thanks for the report! Unfortunately this is a bit of a bitrotted example at this point as the LLVM/Rust release are out of sync, but this should be fixable by dropping the version = "*"
directive!
Still having issues.
error[E0432]: unresolved import `std::heap`
--> src/libc-stub/src/lib.rs:39:10
|
39 | use std::heap::{GlobalAlloc, Global, Layout};
| ^^^^ Could not find `heap` in `std`
Then I change the code to
use std::alloc::Alloc;
use std::alloc::{GlobalAlloc, Global, Layout};
But another error showed up
Compiling libc-stub v0.1.0 (file:///home/qdwang/Codes/tradebot/src/libc-stub)
error[E0605]: non-primitive cast: `std::result::Result<std::ptr::NonNull<u8>, std::alloc::AllocErr>` as `*mut usize`
--> src/libc-stub/src/lib.rs:96:15
|
96 | let ptr = Global.alloc(layout) as *mut usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
error[E0308]: mismatched types
--> src/libc-stub/src/lib.rs:110:20
|
110 | Global.dealloc(ptr as *mut _, layout);
| ^^^^^^^^^^^^^ expected struct `std::ptr::NonNull`, found *-ptr
|
= note: expected type `std::ptr::NonNull<u8>`
found type `*mut _`
error: aborting due to 2 previous errors
I'm using rustc 1.28.0 (9634041f0 2018-07-30)
The wonders of living on nightly! That should be fixable by switching to #[global_allocator]
which likely has an updated signature.
with this toml info
getting this error
I'm trying to use parcel to bundle rust program with sodium into wasm. Don't know how to fix this.