diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 289b96612d..bb69aab008 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -86,3 +86,6 @@ ink-debug = [] # Disable the ink! provided global memory allocator. no-allocator = [ "ink_allocator/no-allocator" ] + +# Disable the ink! provided panic handler. +no-panic-handler = [] diff --git a/crates/env/src/lib.rs b/crates/env/src/lib.rs index f5adef5763..9959ccccef 100644 --- a/crates/env/src/lib.rs +++ b/crates/env/src/lib.rs @@ -55,7 +55,7 @@ pub const BUFFER_SIZE: usize = 16384; #[allow(unused_extern_crates)] extern crate rlibc; -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", feature = "no-panic-handler")))] #[allow(unused_variables)] #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { diff --git a/crates/ink/Cargo.toml b/crates/ink/Cargo.toml index f2790b0714..bb23bdc918 100644 --- a/crates/ink/Cargo.toml +++ b/crates/ink/Cargo.toml @@ -53,3 +53,6 @@ show-codegen-docs = [] # Disable the ink! provided global memory allocator. no-allocator = [ "ink_env/no-allocator" ] + +# Disable the ink! provided panic handler. +no-panic-handler = ["ink_env/no-panic-handler"]