Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 9441a20

Browse files
pepyakingavofyork
authored andcommitted
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.
1 parent 3426552 commit 9441a20

13 files changed

Lines changed: 13 additions & 7 deletions

File tree

Binary file not shown.
Binary file not shown.

polkadot/parachain/test-chains/basic_add/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
//! Basic parachain that adds a number as part of its state.
1818
1919
#![cfg_attr(not(feature = "std"), no_std)]
20-
#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, lang_items, panic_implementation, core_panic_info))]
20+
#![cfg_attr(
21+
not(feature = "std"),
22+
feature(
23+
alloc, core_intrinsics, lang_items, panic_implementation, core_panic_info,
24+
alloc_error_handler
25+
)
26+
)]
2127

2228
#[cfg(not(feature = "std"))]
2329
extern crate alloc;

polkadot/parachain/test-chains/basic_add/src/wasm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
//! Defines WASM module logic.
1818
19-
use core::{intrinsics, panic};
19+
use core::{intrinsics, panic, alloc};
2020
use parachain::{self, ValidationResult};
2121
use parachain::codec::Slicable;
2222
use super::{HeadData, BlockData};
@@ -29,9 +29,9 @@ pub fn panic(_info: &panic::PanicInfo) -> ! {
2929
}
3030
}
3131

32-
#[lang = "oom"]
32+
#[alloc_error_handler]
3333
#[no_mangle]
34-
pub fn oom() -> ! {
34+
pub fn oom(_: alloc::Layout) -> ! {
3535
unsafe {
3636
intrinsics::abort();
3737
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

substrate/runtime-io/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![cfg_attr(not(feature = "std"), no_std)]
2020
#![cfg_attr(not(feature = "std"), feature(lang_items))]
2121
#![cfg_attr(not(feature = "std"), feature(panic_implementation))]
22+
#![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]
2223
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
2324
#![cfg_attr(not(feature = "std"), feature(alloc))]
2425

substrate/runtime-io/without_std.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub fn panic(info: &::core::panic::PanicInfo) -> ! {
4040
}
4141
}
4242

43-
#[lang = "oom"]
44-
pub extern fn oom() -> ! {
43+
#[alloc_error_handler]
44+
pub extern fn oom(_: ::core::alloc::Layout) -> ! {
4545
static OOM_MSG: &str = "Runtime memory exhausted. Aborting";
4646

4747
unsafe {

0 commit comments

Comments
 (0)