Skip to content

Commit 0fafa5a

Browse files
committed
use mini-alloc by default and hide panic handler when std
1 parent ca1f26a commit 0fafa5a

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

Cargo.lock

Lines changed: 22 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ all = "warn"
6363

6464
[workspace.dependencies]
6565
# stylus-related
66-
stylus-sdk = { version = "=0.6.0", default-features = false }
66+
stylus-sdk = "0.6.0"
6767
stylus-proc = { version = "=0.6.0", default-features = false }
6868
mini-alloc = "0.4.2"
6969

contracts/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Once defined as a dependency, use one of our pre-defined implementations by
2222
importing them:
2323
2424
```ignore
25+
use stylus_sdk::prelude::*;
2526
use openzeppelin_stylus::token::erc20::Erc20;
2627
2728
sol_storage! {
@@ -43,14 +44,11 @@ impl MyContract { }
4344
#![deny(rustdoc::broken_intra_doc_links)]
4445
extern crate alloc;
4546

46-
#[global_allocator]
47-
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;
48-
4947
pub mod access;
5048
pub mod token;
5149
pub mod utils;
5250

53-
#[cfg(target_arch = "wasm32")]
51+
#[cfg(all(target_arch = "wasm32", not(feature = "std")))]
5452
#[panic_handler]
5553
fn panic(_info: &core::panic::PanicInfo) -> ! {
5654
loop {}

examples/merkle-proofs/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ use stylus_sdk::{
1414
prelude::{entrypoint, public, sol_storage},
1515
};
1616

17-
#[global_allocator]
18-
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;
19-
2017
#[cfg(target_arch = "wasm32")]
2118
#[panic_handler]
2219
fn panic(_info: &core::panic::PanicInfo) -> ! {

0 commit comments

Comments
 (0)