Skip to content

Commit 2512856

Browse files
committed
Switch to post-rust-1.84 wasm target wasm32v1-none
1 parent d534103 commit 2512856

File tree

11 files changed

+20
-46
lines changed

11 files changed

+20
-46
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
1313
Install rust stable:
1414
```
1515
rustup install stable
16-
rustup +stable target add wasm32-unknown-unknown
16+
rustup +stable target add wasm32v1-none
1717
rustup +stable component add rust-src
1818
```
1919

2020
Install rust nightly:
2121
```
2222
rustup install nightly
23-
rustup +nightly target add wasm32-unknown-unknown
23+
rustup +nightly target add wasm32v1-none
2424
rustup +nightly component add rust-src
2525
```
2626

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ members = [
1313

1414
[workspace.package]
1515
version = "22.0.7"
16-
rust-version = "1.79.0"
16+
rust-version = "1.84.0"
1717

1818
[workspace.dependencies]
1919
soroban-sdk = { version = "22.0.7", path = "soroban-sdk" }

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ all: check test
33
export RUSTFLAGS=-Dwarnings
44

55
CARGO_DOC_ARGS?=--open
6+
NATIVE_ONLY_CRATES:=soroban-spec soroban-spec-rust soroban-ledger-snapshot
7+
NATIVE_PACKAGE_ARGS:=$(foreach i,$(NATIVE_ONLY_CRATES), --package $(i))
8+
WASM_EXCLUDE_ARGS:=$(foreach i,$(NATIVE_ONLY_CRATES), --exclude $(i))
69

710
doc: fmt
811
cargo test --doc -p soroban-sdk -p soroban-sdk-macros --features testutils,hazmat
@@ -12,15 +15,16 @@ test: fmt build
1215
cargo hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test
1316

1417
build: fmt
15-
cargo hack build --target wasm32-unknown-unknown --release
16-
cd target/wasm32-unknown-unknown/release/ && \
18+
cargo hack build --release --workspace $(NATIVE_PACKAGE_ARGS)
19+
cargo hack build --target wasm32v1-none --release --workspace $(WASM_EXCLUDE_ARGS)
20+
cd target/wasm32v1-none/release/ && \
1721
for i in *.wasm ; do \
1822
ls -l "$$i"; \
1923
done
2024

2125
check: build fmt
2226
cargo hack --feature-powerset --exclude-features docs check
23-
cargo hack check --release --target wasm32-unknown-unknown
27+
cargo hack check --release --target wasm32v1-none --workspace $(WASM_EXCLUDE_ARGS)
2428

2529
build-fuzz:
2630
cd tests/fuzz/fuzz && cargo +nightly fuzz check

deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# list here is effectively saying which targets you are building for.
2222
targets = [
2323
{ triple = "x86_64-unknown-linux-gnu" },
24-
{ triple = "wasm32-unknown-unknown" }
24+
{ triple = "wasm32v1-none" }
2525
# The triple can be any string, but only the target triples built in to
2626
# rustc (as of 1.40) can be checked against actual config expressions
2727
#{ triple = "x86_64-unknown-linux-musl" },

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "1.81"
3-
targets = ["wasm32-unknown-unknown"]
2+
channel = "stable"
3+
targets = ["wasm32v1-none"]
44
components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"]

soroban-sdk/src/alloc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ pub struct BumpPointer;
7676

7777
unsafe impl GlobalAlloc for BumpPointer {
7878
#[inline(always)]
79+
#[allow(static_mut_refs)]
7980
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
8081
let (bytes, align) = (layout.size(), layout.align());
8182
let ptr = LOCAL_ALLOCATOR.alloc(bytes, align);

soroban-sdk/src/lib.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,12 @@ pub mod _migrating;
5959
compile_error!("'testutils' feature is not supported on 'wasm' target");
6060

6161
// When used in a no_std contract, provide a panic handler as one is required.
62-
#[cfg(all(not(feature = "alloc"), target_family = "wasm"))]
62+
#[cfg(target_family = "wasm")]
6363
#[panic_handler]
6464
fn handle_panic(_: &core::panic::PanicInfo) -> ! {
6565
core::arch::wasm32::unreachable()
6666
}
6767

68-
// This is a bit subtle: we want to provide a narrowly-scoped feature `"alloc"`
69-
// that provides support for the `alloc` crate and its types, while using our
70-
// allocator (defined below in module `alloc`). We want to do this without
71-
// changing the user-interface a lot (in particular keeping users writing
72-
// `#[no_std]` and mostly not-using the stdlib casually, because it has many
73-
// components that produce large code footprint).
74-
//
75-
// This is _almost_ possible without involving `std` but unfortunately there's
76-
// still an allocation-error handler (`alloc_error_handler`) that there's no
77-
// stable way to install if one only uses the `alloc` crate, so we pull in a
78-
// dependency on `std` here (for now). When the stabilization of the allocation
79-
// error handler registration function happens in some future Rust version, or
80-
// it gets removed which it looks like work is heading towards instead, we can
81-
// remove std.
82-
//
83-
// See these issues for more details:
84-
// - https://github.com/rust-lang/rust/issues/51540
85-
// - https://github.com/rust-lang/rust/issues/66740
86-
// - https://github.com/rust-lang/rust/issues/66741
87-
#[cfg(all(feature = "alloc", target_family = "wasm"))]
88-
extern crate std;
89-
9068
// Here we provide a `#[global_allocator]` that is a minimal non-freeing bump
9169
// allocator, appropriate for a WASM blob that runs a single contract call.
9270
#[cfg(all(feature = "alloc", target_family = "wasm"))]

soroban-sdk/src/tests/contractimport.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ use stellar_xdr::{ScSpecEntry, ScSpecFunctionInputV0, ScSpecFunctionV0, ScSpecTy
55

66
mod addcontract {
77
use crate as soroban_sdk;
8-
soroban_sdk::contractimport!(
9-
file = "../target/wasm32-unknown-unknown/release/test_add_u64.wasm"
10-
);
8+
soroban_sdk::contractimport!(file = "../target/wasm32v1-none/release/test_add_u64.wasm");
119
}
1210

1311
mod addcontract_u128 {
1412
use crate as soroban_sdk;
15-
soroban_sdk::contractimport!(
16-
file = "../target/wasm32-unknown-unknown/release/test_add_u128.wasm"
17-
);
13+
soroban_sdk::contractimport!(file = "../target/wasm32v1-none/release/test_add_u128.wasm");
1814
}
1915

2016
mod subcontract {

soroban-sdk/src/tests/contractimport_with_error.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use soroban_sdk::{contract, contractimpl, symbol_short, Address, Env, Symbol};
33

44
mod errcontract {
55
use crate as soroban_sdk;
6-
soroban_sdk::contractimport!(
7-
file = "../target/wasm32-unknown-unknown/release/test_errors.wasm"
8-
);
6+
soroban_sdk::contractimport!(file = "../target/wasm32v1-none/release/test_errors.wasm");
97
}
108

119
#[contract]

soroban-spec-rust/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ mod test {
123123
use super::{generate, ToFormattedString};
124124
use soroban_spec::read::from_wasm;
125125

126-
const EXAMPLE_WASM: &[u8] =
127-
include_bytes!("../../target/wasm32-unknown-unknown/release/test_udt.wasm");
126+
const EXAMPLE_WASM: &[u8] = include_bytes!("../../target/wasm32v1-none/release/test_udt.wasm");
128127

129128
#[test]
130129
fn example() {

0 commit comments

Comments
 (0)