diff --git a/substrate/polkadot/parachain/test-chains/basic_add/Cargo.toml b/substrate/polkadot/parachain/test-chains/basic_add/Cargo.toml index dd0fc4050d925fc6e0293c307bded727861a4b80..41e745ca1a4b2009e1be0a2bd21c73d1ad7e4012 100644 --- a/substrate/polkadot/parachain/test-chains/basic_add/Cargo.toml +++ b/substrate/polkadot/parachain/test-chains/basic_add/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib"] [dependencies] polkadot-parachain = { path = "../../", default-features = false } -wee_alloc = "0.4.0" +wee_alloc = { git = "https://github.com/rustwasm/wee_alloc", rev = "4e9f23fff1f2474962085ca693f8884db666889f" } tiny-keccak = "1.4" pwasm-libc = "0.2" diff --git a/substrate/polkadot/parachain/test-chains/basic_add/src/lib.rs b/substrate/polkadot/parachain/test-chains/basic_add/src/lib.rs index be21a8dec8caa1aab4f054adfde8b6ff73174778..1ef898f1dc3f544a1570ece789db838f5b69acbb 100644 --- a/substrate/polkadot/parachain/test-chains/basic_add/src/lib.rs +++ b/substrate/polkadot/parachain/test-chains/basic_add/src/lib.rs @@ -17,7 +17,7 @@ //! Basic parachain that adds a number as part of its state. #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, global_allocator, lang_items, panic_implementation))] +#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, lang_items, panic_implementation))] #[cfg(not(feature = "std"))] extern crate alloc; diff --git a/substrate/substrate/pwasm-alloc/src/lib.rs b/substrate/substrate/pwasm-alloc/src/lib.rs index 85be1538150595137e08e0077ee42d774e239234..7dbfb562a91d1fc05bceb5cb6f42e23f7c4d1fad 100644 --- a/substrate/substrate/pwasm-alloc/src/lib.rs +++ b/substrate/substrate/pwasm-alloc/src/lib.rs @@ -2,9 +2,6 @@ #![cfg_attr(feature = "strict", deny(warnings))] #![no_std] #![crate_type = "rlib"] -#![cfg_attr(feature = "nightly", feature(global_allocator))] -#![cfg_attr(feature = "nightly", feature(alloc))] -#![cfg_attr(feature = "nightly", feature(allocator_api))] //! Custom allocator crate for wasm @@ -17,19 +14,18 @@ static ALLOCATOR: WasmAllocator = WasmAllocator; #[cfg(feature = "nightly")] mod __impl { - extern crate alloc; extern crate pwasm_libc; - use self::alloc::heap::{GlobalAlloc, Layout, Opaque}; + use core::alloc::{GlobalAlloc, Layout}; use super::WasmAllocator; unsafe impl GlobalAlloc for WasmAllocator { - unsafe fn alloc(&self, layout: Layout) -> *mut Opaque { - pwasm_libc::malloc(layout.size()) as *mut Opaque + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + pwasm_libc::malloc(layout.size()) as *mut u8 } - unsafe fn dealloc(&self, ptr: *mut Opaque, _layout: Layout) { + unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { pwasm_libc::free(ptr as *mut u8) } }