Fix for nightly 2018-07-10 (#296)

* Use [alloc_error_handler] instead of oom lang item

* Same fix for basic_add

* Drive by fix for duplicate generic parameter

* Rebuild binaries.
This commit is contained in:
Sergey Pepyakin
2018-07-11 16:40:33 +03:00
committed by Gav Wood
parent 23d4704abe
commit a3b1b98a90
13 changed files with 13 additions and 7 deletions
@@ -17,7 +17,13 @@
//! 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, lang_items, panic_implementation, core_panic_info))]
#![cfg_attr(
not(feature = "std"),
feature(
alloc, core_intrinsics, lang_items, panic_implementation, core_panic_info,
alloc_error_handler
)
)]
#[cfg(not(feature = "std"))]
extern crate alloc;
@@ -16,7 +16,7 @@
//! Defines WASM module logic.
use core::{intrinsics, panic};
use core::{intrinsics, panic, alloc};
use parachain::{self, ValidationResult};
use parachain::codec::Slicable;
use super::{HeadData, BlockData};
@@ -29,9 +29,9 @@ pub fn panic(_info: &panic::PanicInfo) -> ! {
}
}
#[lang = "oom"]
#[alloc_error_handler]
#[no_mangle]
pub fn oom() -> ! {
pub fn oom(_: alloc::Layout) -> ! {
unsafe {
intrinsics::abort();
}
@@ -19,6 +19,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(lang_items))]
#![cfg_attr(not(feature = "std"), feature(panic_implementation))]
#![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
#![cfg_attr(not(feature = "std"), feature(alloc))]
@@ -40,8 +40,8 @@ pub fn panic(info: &::core::panic::PanicInfo) -> ! {
}
}
#[lang = "oom"]
pub extern fn oom() -> ! {
#[alloc_error_handler]
pub extern fn oom(_: ::core::alloc::Layout) -> ! {
static OOM_MSG: &str = "Runtime memory exhausted. Aborting";
unsafe {
@@ -72,7 +72,6 @@ pub trait Trait: Eq + Clone {
type Header: Parameter + traits::Header<
Number = Self::BlockNumber,
Hash = Self::Hash,
Hash = Self::Hash,
Digest = Self::Digest
>;
}