Skip to content

Commit 2953787

Browse files
committed
Fix runtime build with the latest rustc
1 parent 7d5e548 commit 2953787

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sp-consensus-grandpa = { default-features = false, git = "https://github.com/par
3838
sp-core = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
3939
sp-genesis-builder = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
4040
sp-inherents = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
41-
sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
41+
sp-io = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e", features = ["disable_panic_handler"] }
4242
sp-offchain = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
4343
sp-runtime = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }
4444
sp-session = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "cdf107de700388a52a17b2fb852c98420c78278e" }

runtime/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub use sp_runtime::{Perbill, Permill};
6464

6565
mod bridge_config;
6666
mod genesis_config_presets;
67+
mod panic_handler;
6768
mod weights;
6869
mod xcm_config;
6970

runtime/src/panic_handler.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Panic handler for builds without `std`.
2+
3+
use sp_core::LogLevel;
4+
5+
#[cfg(not(feature = "std"))]
6+
#[panic_handler]
7+
pub fn panic(info: &core::panic::PanicInfo) -> ! {
8+
let message = alloc::format!("{}", info);
9+
sp_io::logging::log(LogLevel::Error, "runtime", message.as_bytes());
10+
unreachable!();
11+
}

0 commit comments

Comments
 (0)